Skip to content

Commit

Permalink
Merge pull request #719 from thewtex/roi-scale-fetch
Browse files Browse the repository at this point in the history
BUG: Fetch current scale before use in roi methods
  • Loading branch information
thewtex authored Dec 19, 2023
2 parents fe79f8f + 06df873 commit 9aba3d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions itkwidgets/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ async def get_roi_image(self, scale: int = -1, name: str = 'Image') -> NgffImage
:return: roi_image
:rtype: NgffImage
"""
if scale == -1:
scale = await self.get_current_scale()
roi_slices = await self.get_roi_slice(scale)
roi_region = await self.get_roi_region()
if store := self.stores.get(name):
Expand Down Expand Up @@ -498,6 +500,8 @@ async def get_roi_slice(self, scale: int = -1):
:return: roi_slice
:rtype: List[slice]
"""
if scale == -1:
scale = await self.get_current_scale()
idxs = await self.viewer_rpc.itk_viewer.getCroppedIndexBounds(scale)
x0, x1 = idxs['x']
y0, y1 = idxs['y']
Expand Down

0 comments on commit 9aba3d9

Please sign in to comment.