[Insight-users] Beginner question: accessing types in classes (python)

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Feb 25 02:27:16 EST 2009


Le 25 févr. 09 à 07:18, Rick Giuly a écrit :

>
> Hello all,
>
> I'm attempting to write the FastMarching example from the ITK guide  
> in python, and I have run into a problem.
>
> Could someone inform me on what is the proper syntax, in python, for  
> accessing a type (like NodeContainer) which is inside of a class  
> (like FastMarchingImageFilter). I have my attempted guess at the  
> syntax shown below but it did not seem to work.
>

Hi Rick,

Unfortunately, we can't extract the types defined in the c++ classes,  
and thus, we can't make them accessible in python.
So you can't do

> seeds =  
> itk.FastMarchingImageFilter[image_type,image_type].NodeContainer.New()


and have to do something like:

   NodeType = itk.LevelSetNode[InternalPixelType, Dimension]
   NodeContainer = itk.VectorContainer[itk.UI, NodeType]
   seeds = NodeContainer.New()

You can look at the script WrapITK/Python/Tests/ 
FastMarchingImageFilter.py, and the other level set related ones in  
the same directory, for a full example.

Regards,

Gaëtan

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090225/df700846/attachment-0001.pgp>


More information about the Insight-users mailing list