Skip to content

Commit 03f4253

Browse files
committed
ENH: duplicate args for compare_images helper and update docs
1 parent 716662a commit 03f4253

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

itkwidgets/viewer.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -478,43 +478,45 @@ def view(data=None, **kwargs):
478478

479479
return viewer
480480

481-
def compare_images(*args, **kwargs):
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):
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.
485485
486486
Parameters
487487
----------
488488
fixed_image: array_like, itk.Image, or vtk.vtkImageData
489-
Static image the moving image is re-sampled to.
489+
Static image the moving image is re-sampled to. For 'blend and 'cyan-magenta' methods, the fixed image is on the first component.
490490
491491
moving_image: array_like, itk.Image, or vtk.vtkImageData
492-
Image is re-sampled to the fixed_image.
492+
Image is re-sampled to the fixed_image. For 'blend and 'cyan-magenta' methods, the moving image is on the second component.
493493
494-
method: string, default: None, possible values: 'cyan-magenta', 'blend', 'checkerboard'
494+
method: string, default: None, possible values: 'cyan-magenta', 'blend', 'checkerboard', 'disabled'
495495
checkerboard method picks pixels from the fixed and moving image to create a
496-
checkerboard pattern.
496+
checkerboard pattern. The checkerboard as method turns on the checkerboard flag.
497497
cyan-magenta method puts the fixed image on component 0, moving image on component 1
498498
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
500-
and changes the color maps for both to grayscale.
499+
Blend method puts the fixed image on component 0, moving image on component 1.
501500
502-
imageMix: float, default: None
501+
image_mix: float, default: None
503502
Changes the percent contribution the fixed vs moving image makes to the
504503
render by modifying the opacity transfer function. Value of 1 means max opacity for
505-
moving image, 0 for fixed image. Only active when method is cyan-magenta or blend.
504+
moving image, 0 for fixed image. If value is None and the method is "blend" or "cyan-magenta",
505+
the image_mix is set to 0.5. If the method is "checkerboard", the image_mix is set to 0.
506506
507507
checkerboard: bool, default: None
508-
Forces checkerboard pattern for cyan-magenta and blend methods.
508+
Forces the checkerboard mixing of fixed and moving images for the cyan-magenta and blend methods.
509+
The rendered image has 2 components, each component reverses which image is sampled for each
510+
checkerboard box.
509511
510512
pattern: Tuple[int, int, int], default: None
511-
An array with the number of checkerboard boxes for each dimension.
513+
The number of checkerboard boxes for each dimension.
512514
513515
swap_image_order: bool, default: None
514-
Reverses which image is sampled for each checkerboard box.
515-
516+
Reverses which image is sampled for each checkerboard box. This simply toggles
517+
image_mix between 0 and 1.
516518
"""
517519
viewer = view()
518-
viewer.compare_images(*args, **kwargs)
520+
viewer.compare_images(fixed_image, moving_image, method, image_mix, checkerboard, pattern, swap_image_order)
519521
return viewer
520522

0 commit comments

Comments
 (0)