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

Jérôme jerome.velut at gmail.com
Tue Dec 15 03:18:38 EST 2009


Hi David D.,

If I understood well, you write VTK pipeline inside a VTK filter. If so, I
also do that *very* often. My way avoids to get the input data, just
connects the input:
blend->AddInputconnection( this->GetInputConnection( ) ); // 'this' being
your vtkAlgorithm-derived filter.

Secondly, I read with interest the thread in which David G. taught about VTK
pipelining. And I don't think he would have your head for using the
old-fashioned SetInput method. It is just like... old-fashioned, but you
don't "touch" at the data. It is unfair because you add some -maybe-
unuseful static cast, but the integrity of the pipeline is still preserved.

David G. can you confirm my feelings?

Jerome

2009/12/15 David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
>

> The first thing I typically do (and I got this by looking at existing
> filters) at the beginning of a RequestData() is:
>
>  vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
>  vtkImageData *input = vtkImageData::SafeDownCast(
>      inInfo->Get(vtkDataObject::DATA_OBJECT()));
>
> However, now I have an actual object, so I have to do things like the
> following:
>
>  vtkSmartPointer<vtkImageBlend> blend =
> vtkSmartPointer<vtkImageBlend>::New();
>  //blend->AddInputConnection(input->GetOutputPort()); //can't do this
> because 'input' is not an algorithm output
>  blend->AddInput(input);
>
> David G. would have my head for this! How should this be done instead?
>
> Thanks,
>
> David D.
> _______________________________________________
> 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/d9c0dd42/attachment.htm>


More information about the vtkusers mailing list