<div class="gmail_quote">On Wed, Jul 7, 2010 at 2:56 PM, Cyrille Faucheux <span dir="ltr"><<a href="mailto:cyrille.faucheux@etu.univ-tours.fr">cyrille.faucheux@etu.univ-tours.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
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.<br>
<br>
Can somebody confirm if it's the proper way or if there is better/more efficient way to achieve this ?<br></blockquote><div><br>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.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I've a second question concerning the proper way to destroy the pipeline.<br>
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.<br></blockquote>
<div><br>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.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Is it necessary to first "dismantle" the pipeline ?<br></blockquote><div><br>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 :<br>
<br> vtkPolyData *disconnectedPoly = vtkPolyData::New(0;<br> filter->Update() ;<br> disconnectedPoly->ShallowCopy(filter->GetOutput());<br><br>Similarly in ITK, you would use the method "DisconnectPipeline" on an itk::DataObject. For instance :<br>
<br> filter->Update();<br> itk::DataObject::Pointer dataObject = filter->GetOutput();<br> dataObject->DisconnectPipeline();<br><br><br></div></div><br>