Skip to content

Commit 82a29ab

Browse files
authored
Merge pull request #488 from bnmajor/label-fixes
Label fixes
2 parents dd7157a + 92476ab commit 82a29ab

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/integrations/MONAI/transform_visualization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"metadata": {},
150150
"outputs": [],
151151
"source": [
152-
"view(image=data[\"image\"][0, 0, :, :, :] * 255, gradient_opacity=0.4)"
152+
"view(image=data[\"image\"][0, 0, :, :, :] * 255, label_image=data[\"label\"][0, 0, :, :, :] * 255, gradient_opacity=0.4)"
153153
]
154154
},
155155
{

itkwidgets/viewer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
self.init_data = {}
2727

2828
def _get_input_data(self):
29-
input_options = ["data", "image", "point_sets"]
29+
input_options = ["data", "image", "label_image", "point_sets"]
3030
inputs = []
3131
for option in input_options:
3232
data = self._init_viewer_kwargs.get(option, None)
@@ -70,7 +70,7 @@ async def run(self, ctx):
7070
result = await _get_viewer_image(data)
7171
elif render_type is RenderType.POINT_SET:
7272
result = await _get_viewer_point_sets(data)
73-
if not result:
73+
if result is None:
7474
result = data
7575
self.init_data[key] = result
7676

@@ -248,6 +248,9 @@ def view(data=None, **kwargs):
248248
^^^^^^
249249
image : array_like, itk.Image, or vtk.vtkImageData
250250
The 2D or 3D image to visualize.
251+
label_image: array_like, itk.Image, or vtk.vtkImageData
252+
The 2D or 3D label map to visualize. If an image is also provided, the
253+
label map must have the same size.
251254
label_blend: float, default: 0.5
252255
Label map blend with intensity image, from 0.0 to 1.0.
253256
label_names: list of (label_value, label_name)

0 commit comments

Comments
 (0)