Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF: Add keyword arguments to module: actors #898

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fury/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,8 @@ def odf_slicer(
global_cm,
colormap,
opacity,
affine,
B_matrix,
affine=affine,
B=B_matrix,
)


Expand Down
15 changes: 10 additions & 5 deletions fury/actors/odf_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np

from fury.colormap import create_colormap
from fury.decorators import warn_on_args_to_kwargs
from fury.lib import Actor, PolyData, PolyDataMapper
from fury.utils import (
apply_affine,
Expand Down Expand Up @@ -51,6 +52,7 @@ class OdfSlicerActor(Actor):

"""

@warn_on_args_to_kwargs()
def __init__(
self,
odfs,
Expand All @@ -64,6 +66,7 @@ def __init__(
global_cm,
colormap,
opacity,
*,
affine=None,
B=None,
):
Expand Down Expand Up @@ -122,7 +125,8 @@ def display_extent(self, x1, x2, y1, y2, z1, z2):

self._update_mapper()

def slice_along_axis(self, slice_index, axis="zaxis"):
@warn_on_args_to_kwargs()
def slice_along_axis(self, slice_index, *, axis="zaxis"):
"""Slice ODF field at given `slice_index` along axis
in ['xaxis', 'yaxis', zaxis'].
"""
Expand Down Expand Up @@ -156,16 +160,17 @@ def slice_along_axis(self, slice_index, axis="zaxis"):
else:
raise ValueError("Invalid axis name {0}.".format(axis))

def display(self, x=None, y=None, z=None):
@warn_on_args_to_kwargs()
def display(self, *, x=None, y=None, z=None):
"""Display a slice along x, y, or z axis."""
if x is None and y is None and z is None:
self.slice_along_axis(self.grid_shape[2] // 2)
elif x is not None:
self.slice_along_axis(x, "xaxis")
self.slice_along_axis(x, axis="xaxis")
elif y is not None:
self.slice_along_axis(y, "yaxis")
self.slice_along_axis(y, axis="yaxis")
elif z is not None:
self.slice_along_axis(z, "zaxis")
self.slice_along_axis(z, axis="zaxis")

def update_sphere(self, vertices, faces, B):
"""Dynamically change the sphere used for SH to SF projection."""
Expand Down
17 changes: 12 additions & 5 deletions fury/actors/peak.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np

from fury.colormap import boys2rgb, colormap_lookup_table, orient2rgb
from fury.decorators import warn_on_args_to_kwargs
from fury.lib import (
VTK_OBJECT,
Actor,
Expand Down Expand Up @@ -62,10 +63,12 @@ class PeakActor(Actor):

"""

@warn_on_args_to_kwargs()
def __init__(
self,
directions,
indices,
*,
values=None,
affine=None,
colors=None,
Expand Down Expand Up @@ -210,11 +213,12 @@ def __init__(
self.__cross_section = self.__high_ranges // 2

self.__mapper.AddObserver(
Command.UpdateShaderEvent, self.__display_peaks_vtk_callback
Command.UpdateShaderEvent, self.__display_peaks_vtk_callback(None, None)
)

@warn_on_args_to_kwargs()
@calldata_type(VTK_OBJECT)
def __display_peaks_vtk_callback(self, caller, event, calldata=None):
def __display_peaks_vtk_callback(self, caller, event, *, calldata=None):
if calldata is not None:
calldata.SetUniformi("isRange", self.__is_range)
calldata.SetUniform3f("highRanges", self.__high_ranges)
Expand Down Expand Up @@ -275,7 +279,8 @@ def min_centers(self):
return self.__min_centers


def _orientation_colors(points, cmap="rgb_standard"):
@warn_on_args_to_kwargs()
def _orientation_colors(points, *, cmap="rgb_standard"):
"""
Parameters
----------
Expand Down Expand Up @@ -306,7 +311,8 @@ def _orientation_colors(points, cmap="rgb_standard"):
return np.asarray(col_list)


def _peaks_colors_from_points(points, colors=None, points_per_line=2):
@warn_on_args_to_kwargs()
def _peaks_colors_from_points(points, *, colors=None, points_per_line=2):
"""Return a VTK scalar array containing colors information for each one of
the peaks according to the policy defined by the parameter colors.

Expand Down Expand Up @@ -376,7 +382,8 @@ def _peaks_colors_from_points(points, colors=None, points_per_line=2):
return color_array, colors_are_scalars, global_opacity


def _points_to_vtk_cells(points, points_per_line=2):
@warn_on_args_to_kwargs()
def _points_to_vtk_cells(points, *, points_per_line=2):
"""Return the VTK cell array for the peaks given the set of points
coordinates.

Expand Down
Loading