[vtkusers] Breaking the pipeline

Kevin Wright Kevin.Wright at ansys.com
Fri Aug 29 09:09:40 EDT 2003


> with a slightly modification your suggestion works although the 
> img->Register(0) looks weird to me.

Register adds one to the reference count.  The argument is just to specify which object is doing the registering, or you can put null (0) as the argument.  The point was to remove the image data as the output of the filter without it resulting in the image data being deleted.  That being said, I'm not sure that the Register in this case is doing anything.

>      vtkImageData* temp = vtkImageData::New();
>      flip->SetInput(temp);
>      temp->DeepCopy(imData);
>      temp = flip->GetOutput();
>      temp->Update();
>      imData->DeepCopy(temp);
>      flip->RemoveAllInputs();
>      temp->Register(0);
>      temp->Delete();

If you're intent on using the deep copy instead of creating another pipeline, then I think you only need one deep copy:

flip->SetInput(imData);
vtkImageData *temp = flip->GetOutput();
flip->Update();
imData->DeepCopy(temp);
flip->Delete();

Just a note that I think the main reason this is causing you so much trouble is that it is not the way a pipeline setup is supposed to be used.  If you maintain a handle to the actors, then there are much cleaner and more efficient ways that this could be accomplished.

Hope that helps,
Kevin.



More information about the vtkusers mailing list