diff --git a/itkwidgets/viewer.py b/itkwidgets/viewer.py index be584714..69cdbb35 100644 --- a/itkwidgets/viewer.py +++ b/itkwidgets/viewer.py @@ -321,6 +321,28 @@ def set_image_blend_mode(self, mode: str): async def get_image_blend_mode(self): return await self.viewer_rpc.itk_viewer.getImageBlendMode() + @property + @fetch_value + async def color_map(self) -> asyncio.Future | str: + """Get the color map for the current component/channel. + + :return: The future for the coroutine, to be updated with the current + color map. + :rtype: asyncio.Future | str + """ + return await self.viewer_rpc.itk_viewer.getImageColorMap() + @color_map.setter + @fetch_value + async def color_map(self, colorMap: str) -> None: + """Set the color map for the current component/channel. Queue the + function to be run in the background thread once the plugin API is + available. + + :param colorMap: Color map for the current image. default: 'Grayscale' + :type colorMap: str + """ + self.queue_request('setImageColorMap', colorMap) + @fetch_value def set_image_color_map(self, colorMap: str): self.queue_request('setImageColorMap', colorMap) @@ -328,6 +350,28 @@ def set_image_color_map(self, colorMap: str): async def get_image_color_map(self): return await self.viewer_rpc.itk_viewer.getImageColorMap() + @property + @fetch_value + async def color_range(self) -> asyncio.Future | List[float]: + """Get the range of the data values mapped to colors for the given + image. + + :return: _description_ + :rtype: asyncio.Future | List[float] + """ + return await self.viewer_rpc.itk_viewer.getImageColorRange() + @color_range.setter + @fetch_value + async def color_range(self, range: List[float]) -> None: + """The range of the data values mapped to colors for the given image. + Queue the function to be run in the background thread once the plugin + API is available. + + :param range: The [min, max] range of the data values + :type range: List[float] + """ + self.queue_request('setImageColorRange', range) + @fetch_value def set_image_color_range(self, range: List[float]): self.queue_request('setImageColorRange', range) @@ -355,6 +399,26 @@ async def vmax(self): async def vmax(self, vmax: float): self.queue_request('setImageColorRangeMax', vmax) + @property + @fetch_value + async def color_bounds(self) -> asyncio.Future | List[float]: + """Get the range of the data values for color maps. + + :return: The future for the coroutine, to be updated with the + [min, max] range of the data values. + :rtype: asyncio.Future | List[float] + """ + return await self.viewer_rpc.itk_viewer.getImageColorRangeBounds() + @color_bounds.setter + @fetch_value + async def color_bounds(self, range: List[float]) -> None: + """Set the range of the data values for color maps. Queue the function + to be run in the background thread once the plugin API is available. + + :param range: The [min, max] range of the data values. + :type range: List[float] + """ + self.queue_request('setImageColorRangeBounds', range) @fetch_value def set_image_color_range_bounds(self, range: List[float]): @@ -370,6 +434,28 @@ def set_image_component_visibility(self, visibility: bool, component: int): async def get_image_component_visibility(self, component: int): return await self.viewer_rpc.itk_viewer.getImageComponentVisibility(component) + @property + @fetch_value + async def gradient_opacity(self) -> asyncio.Future | float: + """Get the gradient opacity for composite volume rendering. + + :return: The future for the coroutine, to be updated with the gradient + opacity. + :rtype: asyncio.Future | float + """ + return await self.viewer_rpc.itk_viewer.getImageGradientOpacity() + @gradient_opacity.setter + @fetch_value + async def gradient_opacity(self, opacity: float) -> None: + """Set the gradient opacity for composite volume rendering. Queue + the function to be run in the background thread once the plugin API is + available. + + :param opacity: Gradient opacity in the range (0.0, 1.0]. default: 0.5 + :type opacity: float + """ + self.queue_request('setImageGradientOpacity', opacity) + @fetch_value def set_image_gradient_opacity(self, opacity: float): self.queue_request('setImageGradientOpacity', opacity) @@ -377,6 +463,28 @@ def set_image_gradient_opacity(self, opacity: float): async def get_image_gradient_opacity(self): return await self.viewer_rpc.itk_viewer.getImageGradientOpacity() + @property + @fetch_value + async def gradient_opacity_scale(self) -> asyncio.Future | float: + """Get the gradient opacity scale for composite volume rendering. + + :return: The future for the coroutine, to be updated with the current + gradient opacity scale. + :rtype: asyncio.Future | float + """ + return await self.viewer_rpc.itk_viewer.getImageGradientOpacityScale() + @gradient_opacity_scale.setter + @fetch_value + async def gradient_opacity_scale(self, min: float) -> None: + """Set the gradient opacity scale for composite volume rendering. Queue + the function to be run in the background thread once the plugin API is + available. + + :param min: Gradient opacity scale in the range (0.0, 1.0] default: 0.5 + :type min: float + """ + self.queue_request('setImageGradientOpacityScale', min) + @fetch_value def set_image_gradient_opacity_scale(self, min: float): self.queue_request('setImageGradientOpacityScale', min)