[Insight-users] python prototyping advice

Einstein, Daniel R daniel.einstein at pnl.gov
Wed Aug 17 14:46:10 EDT 2005


Gaetan,

I am very much interested in prototyping with python as well. I have a little experience with ITK now, and have worked somewhat with the InsightToolkit module (unfortunately this is something I must do in my spare time). I find the wrapping uneven. I was able to do it on one of my machines but the other is being a bit more difficult. 

Anyway, could you clarify the comment you made to Richard about ipython? What exactly does the ipython patch allow you to do?

Also, in terms of your public directory, I see all of the classes that you have wrapped. But these won't these need to be re-wrapped on our local machines? Or am I missing something?

Thank you for your help

Best Regards,
Dan 


Daniel R Einstein, PhD
Biological Monitoring and Modeling
Pacific Northwest National Laboratory
P.O. Box 999; MSIN P7-59
Richland, WA 99352
Tel: 509/ 376-2924
Fax: 509/376-9064
daniel.einstein at pnl.gov


-----Original Message-----
From: insight-users-bounces+daniel.einstein=pnl.gov at itk.org [mailto:insight-users-bounces+daniel.einstein=pnl.gov at itk.org] On Behalf Of Gaetan Lehmann
Sent: Tuesday, August 16, 2005 11:58 PM
To: Richard.Beare at ieee.org
Cc: insight-users at itk.org
Subject: Re: [Insight-users] python prototyping advice


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
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list