[vtkusers] Reseting vtk pipeline

John Biddiscombe biddisco at cscs.ch
Fri Jun 19 06:52:54 EDT 2009


Nasos

> The most vtk-friendly way I find is by disconnecting each object, 
> update it and then recreate the pipeline, without deleting any vtk 
> item. Obviously this is a tedious process and I feel it is not the 
> most elegant one. Is there any other way that will resolve my situation?

One way that is a compromise between disconnecting and recreating is to 
have a pipeline that looks like this

pnmReader    ->
                filter1 -> filter2 -> Mapper -> etc
vtkImageData ->

When the user selects a new project, simply 
filter1->SetInput(myBlankImageData), and when they select a valid file, 
filter1->SetInputConnection(pnmReader->GetOutputPort())
The ImageData referred to is simply a blank image of 1 pixel (or more if 
it makes the rest of your pipeline easier). The filters exist in memory 
permanently, but you switch pipeline

Also google vtkUpdateSuppressor, which is used in paraview. You could 
also create a simple vtkImageSelector class which takes multiple inputs 
and one is valid, one dummy, by setting a flag on it, you can switch the 
pipeline as desired.

JB

-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the vtkusers mailing list