[vtkusers] Updating and destroying the pipeline

Cyrille Faucheux cyrille.faucheux at etu.univ-tours.fr
Wed Jul 7 05:26:41 EDT 2010


Hi,

I've just started working with ITK and VTK a few days ago, so right now 
I'm just playing with it.

My "toy" application is a Qt window (containing a QVTKWidget) in which I 
want to be able to display one slice of a 3D image (dynamically selected 
by a slider).

So I have:
- The QVTKWidget for the display;
- an itk::ImageReader to load my image;
- an itk::ImageToVTKImageFilter to connect the ITK image to the VTK part 
of the pipeline;
- and a vtkImageViewer for the rendering.

Right now, when I open an image, I create a new reader, a new connector 
and a new viewer, connect them, then set the render window of the 
QVTKWidget to the one obtained from the viewer. And again when I open a 
new image (everything works fine).

Creating and connecting all these objects seems to be the proper way to 
build the pipeline in order to display an image, but recreating and 
reconnecting everything seems wrong to me when I want to open another image.

Can somebody confirm if it's the proper way or if there is better/more 
efficient way to achieve this ?


I've a second question concerning the proper way to destroy the pipeline.
Right now, everything is automatically deleted since I use smart 
pointers. But again, it seems wrong to me to let the application decide 
about the order of deletion of these objects since they are all connected.

Do I have to worry about this ?If the answer is yes, what is the clean 
way ? Is it necessary to first "dismantle" the pipeline ?

Thanks in advance.
Cyrille



More information about the vtkusers mailing list