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

Jérôme jerome.velut at gmail.com
Tue Dec 15 12:13:10 EST 2009


Oops... it seems that I understand now some weird "bad extent" happening...
I will keep this thread bookmarked, since it teaches a lot about VTK
pipelining!

This made me look at the documentation of ShallowCopy/DeepCopy. Finally, I
found this class:
http://www.vtk.org/doc/nightly/html/classvtkCell.html#a573202e8c9c3b5367b35fe7ad3fdfb43

where it is said that ShallowCopy is for read-only copy... Is the code
snippet right? ShallowCopying the output of the internal filter should then
produce a read-only output for the main filter!

Do I mistake if I rather propose:
inputCopy->ShallowCopy(input);
blend->AddInput(inputCopy);
blend->Update();
output->DeepCopy(blend->GetOutput());

Jerome

2009/12/15 Michael Jackson <mike.jackson at bluequartz.net>

>
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091215/c15aea8a/attachment.htm>


More information about the vtkusers mailing list