Skip to content

Commit 9ac92b6

Browse files
committed
FIX: type of compare_images pattern kwarg can be 2 dimensional
1 parent ed2f9c1 commit 9ac92b6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

itkwidgets/viewer.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def set_image_volume_sample_distance(self, distance: float):
275275
def set_image_volume_scattering_blend(self, scattering_blend: float):
276276
self.queue_request('setImageVolumeScatteringBlend', scattering_blend)
277277

278-
def compare_images(self, fixed_image: Union[str, Image], moving_image: Union[str, Image], method: str = None, image_mix: float = None, checkerboard: bool = None, pattern: Tuple[int, int, int] = None, swap_image_order: bool = None):
278+
def compare_images(self, fixed_image: Union[str, Image], moving_image: Union[str, Image], method: str = None, image_mix: float = None, checkerboard: bool = None, pattern: Union[Tuple[int, int], Tuple[int, int, int]] = None, swap_image_order: bool = None):
279279
# image args may be image name or image object
280280
fixed_name = 'Fixed'
281281
if isinstance(fixed_image, str):
@@ -478,7 +478,7 @@ def view(data=None, **kwargs):
478478

479479
return viewer
480480

481-
def compare_images(fixed_image: Union[str, Image], moving_image: Union[str, Image], method: str = None, image_mix: float = None, checkerboard: bool = None, pattern: Tuple[int, int, int] = None, swap_image_order: bool = None):
481+
def compare_images(fixed_image: Union[str, Image], moving_image: Union[str, Image], method: str = None, image_mix: float = None, checkerboard: bool = None, pattern: Union[Tuple[int, int], Tuple[int, int, int]] = None, swap_image_order: bool = None):
482482
"""Fuse 2 images with a checkerboard filter or as a 2 component image.
483483
484484
The moving image is re-sampled to the fixed image space. Set a keyword argument to None to use defaults based on method.
@@ -492,11 +492,10 @@ def compare_images(fixed_image: Union[str, Image], moving_image: Union[str, Imag
492492
Image is re-sampled to the fixed_image. For 'blend and 'cyan-magenta' methods, the moving image is on the second component.
493493
494494
method: string, default: None, possible values: 'cyan-magenta', 'blend', 'checkerboard', 'disabled'
495-
checkerboard method picks pixels from the fixed and moving image to create a
496-
checkerboard pattern. The checkerboard as method turns on the checkerboard flag.
497-
cyan-magenta method puts the fixed image on component 0, moving image on component 1
498-
and changes the color map for fixed image to cyan, moving image to magenta.
499-
Blend method puts the fixed image on component 0, moving image on component 1.
495+
The checkerboard method picks pixels from the fixed and moving image to create a
496+
checkerboard pattern. Setting the method to checkerboard turns on the checkerboard flag.
497+
The blend and cyan-magenta method puts the fixed image on component 0, moving image on component 1.
498+
The cyan-magenta method also changes the color map for fixed image to cyan, moving image to magenta.
500499
501500
image_mix: float, default: None
502501
Changes the percent contribution the fixed vs moving image makes to the
@@ -509,14 +508,14 @@ def compare_images(fixed_image: Union[str, Image], moving_image: Union[str, Imag
509508
The rendered image has 2 components, each component reverses which image is sampled for each
510509
checkerboard box.
511510
512-
pattern: Tuple[int, int, int], default: None
511+
pattern: Union[Tuple[int, int], Tuple[int, int, int]], default: None
513512
The number of checkerboard boxes for each dimension.
514513
515514
swap_image_order: bool, default: None
516515
Reverses which image is sampled for each checkerboard box. This simply toggles
517516
image_mix between 0 and 1.
518517
"""
519518
viewer = view()
520-
viewer.compare_images(fixed_image, moving_image, method, image_mix, checkerboard, pattern, swap_image_order)
519+
viewer.compare_images(fixed_image=fixed_image, moving_image=moving_image, method=method, image_mix=image_mix, checkerboard=checkerboard, pattern=pattern, swap_image_order=swap_image_order)
521520
return viewer
522521

0 commit comments

Comments
 (0)