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

Bill Lorensen bill.lorensen at gmail.com
Tue Dec 15 12:35:11 EST 2009


ITK's smartpointers do all of the bookkeeping for you. There are
probably tricky pipeline issues that exist in vtk that don't exist is
itk.



On Tue, Dec 15, 2009 at 12:07 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
>
>
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list