How to render an ITK spatial object?


#1

Dear everyone,

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

Best and thanks,
Tao Han


(Matt McCormick) #2

Hi @TaoH,

Which type of SpatialObject would you like to render?

Matt


#3

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,
TaoH


(Jon Haitz Legarreta Gorroño) #4

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.


#5

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?


(Matt McCormick) #6

Hi @TaoH,

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

Which specific spatial objects are you interested in?


(Pablo Hernandez-Cerdan) #7

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"
...
itk::ViewImage<ImageType>::View(filterToImage->GetOutput());

It works with 2D and 3D images.


(Dženan Zukić) #8

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


#9

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.


(Dženan Zukić) #10

and then visualize it.


(Pablo Hernandez-Cerdan) #11

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: