[vtk-developers] Templated filters

Karthik Krishnan karthik.krishnan at kitware.com
Sat Feb 6 11:27:46 EST 2010


1. With VTK, we don't use templates in the interface (header files)
due to wrapping issues. That said, vtkFilter<vtkPointSet, vtkPolyData>
is probably abstract, so it won't be be wrapped anyway; so this may be
a non-issue

2. One can add more than one input on a single port (append filters)
or more than one input port.. I do not think the templated superclass
can capture all of these cases.. One still needs to override those
information methods.

3. With the advent of the new pipeline, a lot of work has gone into
separating the terminology "input" from "port". This kind of a
templated superclass is reverting to the older mindset..



On Sat, Feb 6, 2010 at 11:07 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>



More information about the vtk-developers mailing list