Skip to content

Commit

Permalink
ENH: Add vmin and vmax to viewer
Browse files Browse the repository at this point in the history
Closes #723
  • Loading branch information
PaulHax committed Dec 21, 2023
1 parent a6a38cf commit 7a74f8e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions itkwidgets/_initialization_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def init_params_dict(itk_viewer):
'blend_mode': itk_viewer.setImageBlendMode,
'cmap': itk_viewer.setImageColorMap,
'color_range': itk_viewer.setImageColorRange,
'vmin': itk_viewer.setImageColorRangeMin,
'vmax': itk_viewer.setImageColorRangeMax,
'color_bounds': itk_viewer.setImageColorRangeBounds,
'component_visible': itk_viewer.setImageComponentVisibility,
'gradient_opacity': itk_viewer.setImageGradientOpacity,
Expand Down
21 changes: 21 additions & 0 deletions itkwidgets/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,27 @@ def set_image_color_range(self, range: List[float]):
async def get_image_color_range(self):
return await self.viewer_rpc.itk_viewer.getImageColorRange()

@property
@fetch_value
async def vmin(self):
range = await self.get_image_color_range()
return range[0]
@vmin.setter
@fetch_value
async def vmin(self, vmin: float):
self.queue_request('setImageColorRangeMin', vmin)

@property
@fetch_value
async def vmax(self):
range = await self.get_image_color_range()
return range[1]
@vmax.setter
@fetch_value
async def vmax(self, vmax: float):
self.queue_request('setImageColorRangeMax', vmax)


@fetch_value
def set_image_color_range_bounds(self, range: List[float]):
self.queue_request('setImageColorRangeBounds', range)
Expand Down

0 comments on commit 7a74f8e

Please sign in to comment.