[vtk-developers] Templated filters

David Gobbi david.gobbi at gmail.com
Mon Feb 8 15:02:14 EST 2010


Hi Will,

I'm sure this has come up before, but it seems like an ideal way to
provide a typeless layer for ITK is to wrap ITK into a collection of
VTK classes.

One issue with any typeless layer for ITK is that it will be almost as
big as the ITK wrappers.  The weight comes from instantiating all
those templates.  VTK's image filters have the advantage that only the
Execute methods are templated.

In any case, I hope that the ITK typeless layer will resolve types via
virtual method calls, rather than by the huge switch statements that
VTK uses.

   David


On Mon, Feb 8, 2010 at 12:44 PM, Will Schroeder
<will.schroeder at kitware.com> wrote:
> 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
>>
>
>
> _______________________________________________
> 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