[vtkusers] Updating and destroying the pipeline

Karthik Krishnan karthik.krishnan at kitware.com
Wed Jul 7 14:09:05 EDT 2010


On Wed, Jul 7, 2010 at 2:56 PM, Cyrille Faucheux <
cyrille.faucheux at etu.univ-tours.fr> wrote:

>
> 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 ?
>

If you've set things up correctly, there should be no need to reconnect
everything again. The pipeline will ensure that an update of the output (or
render) will account for any changes in the input at any stage of the
pipeline.


> 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.
>

Why is this of concern ? You can always force smart pointers to go out of
scope by setting the smart pointer to NULL at any point.


>
> Is it necessary to first "dismantle" the pipeline ?
>

I'm not sure what you understand by "dismantle" a pipeline. If you mean
disconnect a data-object from the pipeline, its done in VTK via a shallow
copy. For instance :

  vtkPolyData *disconnectedPoly = vtkPolyData::New(0;
  filter->Update() ;
  disconnectedPoly->ShallowCopy(filter->GetOutput());

Similarly in ITK, you would use the method "DisconnectPipeline" on an
itk::DataObject. For instance :

  filter->Update();
  itk::DataObject::Pointer dataObject = filter->GetOutput();
  dataObject->DisconnectPipeline();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100707/7a9c760c/attachment.htm>


More information about the vtkusers mailing list