[vtk-developers] Templated filters

Will Schroeder will.schroeder at kitware.com
Mon Feb 8 14:44:05 EST 2010


ITK provides an interesting case study w.r.t wrapping.

When the project began 11 years ago, the designers went extreme and jumped
headlong into templating. While the system is very successful overall, the
use of wrapping IMO has been a failure. There are a lot of reasons, but a
few that stand out are

1) somebody somewhere has to decide which templates are to be instantiated,
in ITK we generally choose many native types (e.g., char, short, long,
float, double, etc.) and 2 and 3 dimensions. When wrapped this created
massive libraries.
2) the wrapped classes end up having awful names reflecting their
instantiation choices, e.g.  itkOtsuThresholdImageCalculatorUS3 (US3 meaning
unsigned short, 3 dimensions).
3) the resulting "scripts" (e.g., in python) ended up being specific to an
instantiation, e.g., a script would specifically handle a type and dimension
(unless the script was manually unrolled to handle multiple permutations of
template parameters).
4) Some users found templates hard to understand and use.

I have heard a lot of criticisms of ITK (as well as many compliments of
course) but the one that sticks with me was "I like ITK except I wish it was
VTK".

And very recently, the National Library of Medicine is in the middle of
awarding a RFQ to create the next generation ITK v4. One of the major
requests by the NLM is to create a "typeless" layer akin to VTK so that
users can write applications where they don't have to worry about type and
instantiations quite as much.

Will


On Mon, Feb 8, 2010 at 1:50 PM, Timothy M. Shead <tshead at sandia.gov> wrote:

> Berk Geveci wrote:
>
>  There are some other exceptions (for which we don't have a solution
>> for wrapping). See the new array classes vtkTypedArray,
>> vtkSparseArray, vtkDenseArray. My expectation that these classes will
>> never be wrapped.
>>
>
> This may be just be me, but my hope is that we can come-up with a
> more-flexible wrapping mechanism to handle these sorts of special-cases.  As
> a real-world example, I've used Boost.Python to wrap templated container
> classes for other projects.
>
> Cheers,
> Tim
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100208/d3243f4b/attachment.html>


More information about the vtk-developers mailing list