[Insight-users] python prototyping advice

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Aug 17 02:57:55 EDT 2005


Hi Richard,

I'm glad to see another ITK user who wants to do prototyping with python.  
I'm not the only one ! ;-) Sadely prototyping with python is not a  
priority for ITK developers, and there is lot of things which make  
prototyping with python difficult (the small number of wrapped class to  
begin).

You may be interested in the work I have already done on wrapper. ITK is a  
huge library, and wrapping all classes with a large set of types would  
produce too large executables. To increase the number of wrapped classes,  
I decided to wrap only unsigned short and float type, in 2 and 3  
dimensions (US2, US3, F2, F3). This way, I have wrapped lots more filters  
with only a small increase of executables size.
This work is kept in sync with ITK CVS repository and is available in a  
darcs repository at http://voxel.jouy.inra.fr/darcs/itk-mima2/
It also include some work done on mathematical morphology filters, and a  
module for python (the module is named itk) which introduce facilities   
for prototyping, especially with ipython.
If you are a ipython user, I advise you to checkout a fresh svn version of  
ipython: it contains a patch which allow completion to work with ITK. That  
make prototyping really easier. If you're not a ipython user, you should  
try it quickly ;-)

If you're interested in improving ITK, you should consider joining the  
developers mailing list which is the right list to talk about that. On  
this list, we are also talking with Benoit Regrain of what can be done to  
make ITK more usable with python and to improve wrap process. You are  
welcome in the discussion if you're interested in :-)

Gaetan

On Wed, 17 Aug 2005 08:01:07 +0200, Richard Beare  
<richard.beare at gmail.com> wrote:

> Hi,
>
> I'm trying to stick with prototyping using python for simpler trials.
> At the moment this includes mimicing a few old matlab scripts. This
> brings me to my two questions.
>
> Every time I've attempted to do something in python I've been slowed
> down by missing wrappers. Some of these are easy enough to add (I hope
> this is true - I'm waiting for the build to finish at the moment).
> Assuming I've done this successfully, is there any way I can commit
> these additions back to the repository? What is the protocol for this
> type of thing?
>
> The other question relates to certain types of operations that are
> often done in interactive interpreter environments like matlab or R.
> The particular matlab script I'm porting has a step where every pixel
> in a mask is weighted by the distance to the mask center of gravity.
>
> The approach in matlab is to generate coordinate images and operate on  
> them e.g
>
> dist = sqrt((xcoords - xcog).^2 + (ycoords - ycog).^2);
>
> result = mask * dist
>
> How do I do something equivalent in python? Is this where the numarray
> stuff comes in?
>
> Thanks
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



-- 
Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr>
Tel: +33 1 34 65 29 66
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
Web: http://voxel.jouy.inra.fr


More information about the Insight-users mailing list