@@ -314,16 +314,49 @@ async def get_image_volume_scattering_blend(self):
314314
315315 @fetch_value
316316 async def get_current_scale (self ):
317+ """Get the current resolution scale of the primary image.
318+
319+ 0 is the highest resolution. Values increase for lower resolutions.
320+
321+ :return: scale
322+ :rtype: int
323+ """
317324 return await self .viewer_rpc .itk_viewer .getLoadedScale ()
318325
319326 @fetch_value
320327 async def get_roi_region (self ):
328+ """Get the current region of interest in world / physical space.
329+
330+ Returns [lower_bounds, upper_bounds] in the form:
331+
332+ [{ 'x': x0, 'y': y0, 'z': z0 }, { 'x': x1, 'y': y1, 'z': z1 }]
333+
334+ :return: roi_region
335+ :rtype: List[Dict[str, float]]
336+ """
321337 bounds = await self .viewer_rpc .itk_viewer .getCroppedImageWorldBounds ()
322338 x0 , x1 , y0 , y1 , z0 , z1 = bounds
323339 return [{ 'x' : x0 , 'y' : y0 , 'z' : z0 }, { 'x' : x1 , 'y' : y1 , 'z' : z1 }]
324340
325341 @fetch_value
326342 async def get_roi_slice (self , scale = - 1 ):
343+ """Get the current region of interest as Python slice objects for the
344+ current resolution of the primary image. The result is in the order:
345+
346+ [z_slice, y_slice, x_slice]
347+
348+ Not that for standard C-order NumPy arrays, this result can be used to
349+ directly extract the region of interest from the array. For example,
350+
351+ roi_array = image.data[roi_slice]
352+
353+ :param scale: scale of the primary image to get the slices for the
354+ current roi. -1, the default, uses the current scale.
355+ :type scale: int
356+
357+ :return: roi_slice
358+ :rtype: List[slice]
359+ """
327360 idxs = await self .viewer_rpc .itk_viewer .getCroppedIndexBounds (scale )
328361 x0 , x1 = idxs ['x' ]
329362 y0 , y1 = idxs ['y' ]
0 commit comments