Dear everyone,
I want to render an ITK spatial object. Is there a convenient to make it?
Best and thanks,
Tao Han
Dear everyone,
I want to render an ITK spatial object. Is there a convenient to make it?
Best and thanks,
Tao Han
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
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.
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?
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.
@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!