Skip to content

Commit 9cbc5b5

Browse files
committed
BUG: Select roi on itk image
Add a section to the Select ROI notebook on how to apply it to an itk.Image. Also fix a few bugs discovered in the process: 1. For slices, it should be index + 1 for the stop value 2. Ensure the slice indexes are integers.
1 parent 0eb5564 commit 9cbc5b5

File tree

2 files changed

+94
-20
lines changed

2 files changed

+94
-20
lines changed

examples/integrations/itk/SelectROI.ipynb

Lines changed: 93 additions & 19 deletions
Large diffs are not rendered by default.

itkwidgets/viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async def get_roi_slice(self, scale=-1):
361361
x0, x1 = idxs['x']
362362
y0, y1 = idxs['y']
363363
z0, z1 = idxs['z']
364-
return np.index_exp[z0:z1, y0:y1, x0:x1]
364+
return np.index_exp[int(z0):int(z1+1), int(y0):int(y1+1), int(x0):int(x1+1)]
365365

366366
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):
367367
# image args may be image name or image object

0 commit comments

Comments
 (0)