Help displaying a 3D Dicom and the corresponding segmentation Slicewise using itkwidgets

I am able to display the 3D Dicom read using simple ITK and also overlay the corresponding segmentation mesh in vtkpolydata format.

Now I am trying to display the same image slice wise (kind of like an extension of the example in the examples/2DImage.ipynb). As a bonus, it would be great if I could visualize the corresponding mesh on those slices.

Is it possible to do something like this? And would itkwidgets be the right tool? I really like the convenience of quickly visualizing these images within the notebook rather than writing out both the image and segmentation meshes.

Another issue perhaps related is that whenever I use the view() as part of the loop, it does not display anything. I have to use view() in a separate cell. Is that by design or is it a bug?

Any guidance would be appreciated.

@matt.mccormick can best answer this.

Hello @Kashyap,

If you are working in SimpleITK and have the segmentation as a label map there are several ways of overlaying it onto the original image. For the various options see this Jupyter notebook.

1 Like

@zivy Could you add a “Launch binder” button to each notebook in SimpleITK-Notebooks. Now it takes several clicks to go back to the main page, find the binder link, launch it, wait for it to start, and find the page that you originally wanted to run - and probably many people don’t know that you can quickly try things in binder.

@Kashyap You may also try 3D Slicer’s Jupyter kernel for more advanced interactive visualization of medical images in notebooks. Latest version of SimpleITK, VTK, DICOM toolkits, etc. are already bundled. You can do the usual volume slicing but also volume rendering, visualization of surface meshes, and can interactively add/edit landmarks, curves, and other markups, do interactive segmentation, registration, etc. (all features of 3D Slicer application and its extensions are available). You can give it a quick try on binder or you can use it on your computer.


Good suggestion. Will add to all notebooks.


@zivy and @lassoan Thanks for the resources. Both look great. I will try out both these options.

1 Like