[Insight-users] WrapITK: Determining an Image type dynamically in Python

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Jul 23 14:42:02 EDT 2009


Le 22 juil. 09 à 01:30, Chapman, Brian a écrit :

> Within WrapITK is there an analogous function to GetImageDimension()  
> that
> returns the image type (e.g. itk.US)?
>

Hi Brian,

You can use the function "itk.template()", which returns a tuple with:
* the templated class
* a list of the templated parameters

 >>> img
<itkImagePython.itkImageUC3; proxy of <Swig Object of type  
'itkImageUC3 *' at 0x29080f0> >

 >>> itk.template(img)
(<itkTemplate itk::Image>, (<itkCType unsigned char>, 3))

 >>> itk.template(img)[1][0]
<itkCType unsigned char>

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.itk.org
http://www.mandriva.org  http://www.bepo.fr

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


More information about the Insight-users mailing list