How to render an ITK spatial object?

Dear everyone,

I want to render an ITK spatial object. Is there a convenient to make it?

Best and thanks,
Tao Han

Hi @TaoH,

Which type of SpatialObject would you like to render?


1 Like

Hi @matt.mccormick,
Thank you for your reply.
I want to render ITK spatial objects such as TubeSpatialObject, CylinderSpatialObject or ArrowSpatialObject. Is there any interface depending on ITK and VTK?
Best wishes,

May be Chapter 5 in the ITK Software Guide can be of help.

An itk::Image instance can be visualized directly using the VtkGlue bridge, where Pablo’s runViewImage example becomes very handy. So you may need to translate your itk::SpatialObject to an itk::Image using the itk::SpatialObjectToImageFilter.

If any of your objects contains a mesh, you can write it to file and then read it with VTK as a vtk::PolyData in order to render it.

1 Like

Thanks for your advice! However, A 3D itk::Image instance can not be visualized with runViewImage. Is there any handy way to render 3D ITK spatial objects?

Hi @TaoH,

I am looking at adding support for ITK spatial objects to the ITKVTKGlue module.

Which specific spatial objects are you interested in?

1 Like

runViewImage is a CLI script wrapping around itk::ViewImage. You can use that function directly in your c++ code to visualize any image instance with:

#include "itkViewImage.h"

It works with 2D and 3D images.

@matt.mccormick He already mentioned the spatial objects he is interested in:

Thank you for your reply! This function just visualizes 3D images with three planes. However, I want to render the spatial object. Could you provide a handy advice for me? Thanks again.

and then visualize it.

With the tools available in ITKVtkGlue right now you have to go with transforming a SpatialObject to an Image, as @jhlegarreta suggested. But it seems that the capability to render Spatial Objects is in the roadmap!

:partying_face: :drum:

1 Like