[Insight-users] itk python wrapper quality is far from itk c++ quality

Brad King brad.king at kitware.com
Tue Mar 8 10:06:18 EST 2005


Gaetan Lehmann wrote:
> I'm currently trying to use ITK in python, and I must say it's really 
> hard  for several reasons :
> 
> + lots of filters are missing (for example, most of morpho filters,  
> IntensityWindowingImageFilter, ...)
> + somes filters simply don't works. For example,  
> itkRescaleIntensityImageFilter don't support SetInput (!)
> + One of the wonderfull feature of python is to be able explore  
> attributes. With ipython, we can complete attributes name with <tab> 
> like  bash completion. This make prototyping really easier. With ITK, I 
> just get  an error message when hitting TAB to complete the name of an 
> attribute.  The naming policy produce a large number of name (120 
> different names for  itkRescaleIntensityImageFilter for example). This 
> large amount of names  makes completion difficult to use.
> + Simple array-like objetcs like Size, Index, ... don't use python  
> interface. They can't be accessed with index[0] = value and there is no  
> automatic conversion from python array or tuple object to those ones.
> + help function list attributes but not doc of attributes
> + How can we use colored image ?

There are two main causes:

1.) ITK is templated so a specific set of instantiations has to be 
maintained manually.  Supporting more than a few types makes the 
wrappers huge.

2.) The wrapping process is fully automatic once the set of 
instantiations has been specified.  Very little time has been put into 
making things convenient from python simply because no developer has 
really needed it.

> Make all classes avaible and make it work seems to be the minimal 
> things  to do.

We do have some plans to tie together explicit instantiations in C++ of 
most templates with the wrapping of the same instantiations but this has 
not been implemented.

> Why is there BasicFilters A and B ?

There are so many instantiations of so many templates that the wrapping 
library for BasicFilters got too big for some platforms to handle.  The 
simplest solution was to split it into two libraries.

> All filters have not the same types avaible. How types are choosed for 
> a given filter ?

These have been added on an as-needed basis.  As I said above there are 
plans to standardize the set but they have not been implemented.

> How inheritance is managed ?

This is more of a SWIG issue.  I THINK this is how it works, but I'm not 
sure: Basically a separate wrapper is generated for each class.  When 
one wrapper cannot find a needed method it calls the wrapper for its 
superclass.

-Brad


More information about the Insight-users mailing list