[vtkusers] How to get the input to a filter as algorithm output?

Michael Jackson mike.jackson at bluequartz.net
Tue Dec 15 12:07:11 EST 2009



On Dec 15, 2009, at 11:53 AM, Bill Lorensen wrote:

> After seeing Berk's reply it looks as though his
> vtkImageData* inputCopy = input->NewInstance();
> inputCopy->ShallowCopy(input);
> blend->AddInput(inputCopy);
> blend->Update();
> output->ShallowCopy(blend->GetOutput());
>
> would be:
>
> blend->AddInput(input);
> blend->Update()
> this->GraftOutput(blend->GetOutput());

Bill,
   As, Berk explained, you _really_ need to have a shallow copy to  
decouple the internal and external pipelines. If this is not done the  
all sorts of "Bad" will happen.

  Maybe what is needed is this:

/* Get a Shallow copy from the input */
vtkImageData* inputCopy = input->NewShallowCopyInstance();
blend->AddInput(inputCopy);
blend->Update();
output->ShallowCopy(blend->GetOutput());
/* Don't Forget to memory clean up somewhere.*/

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



More information about the vtkusers mailing list