Skip to content

Commit

Permalink
RF: Added keyword arguments to Actors module
Browse files Browse the repository at this point in the history
  • Loading branch information
WassCodeur committed Jul 10, 2024
1 parent c706a6f commit c9b166b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
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

0 comments on commit c9b166b

Please sign in to comment.