[vtk-developers] Templated filters

David Doria daviddoria+vtk at gmail.com
Sat Feb 6 11:07:40 EST 2010


Is there any reason we can't have a templated single input, single output
filter?

Currently, it looks like the preferred method is to derive from the class
*Algorithm of the intended output type and change the input type in the
FillInputPortInformation function.

Lets take an example of a filter which takes as input a vtkPointSet and
produces a vtkPolyData:

*Current method:*

class MyFilter : vtkPolyDataAlgorithm

int MyFilter::FillInputPortInformation( int port, vtkInformation* info )
{
  if (port == 0)
    {
    info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPointSet" );
    return 1;
    }

  return 0;
}

*Proposed method:*
*
*
class MyFilter : vtkFilter<vtkPointSet, vtkPolyData>
*
*
*
*
Thoughts? I may be over my head in template programming and pipeline stuff,
but maybe the experts can discuss/comment?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100206/f4b7c20f/attachment.html>


More information about the vtk-developers mailing list