[Insight-users] GetImageDimension and WrapITK

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Tue Aug 11 12:33:09 EDT 2009


Le 11 août 09 à 11:50, Charl Botha a écrit :

> 2009/8/11 Rick Giuly <rgiuly at gmail.com>:
>> As far as I can tell, the wrapped Image class (in python) does not  
>> have the
>> GetImageDimension method. I did a "dir" and couldn't find anything.  
>> Is there
>> some way to ask an Image instance what the dimension is?
>
> With WrapITK 0.3.0 on ITK 3.14.0 I get the following:
> import itk
> a = itk.Image[itk.F, 3].New()
> print a.GetImageDimension()
> 3
>
> With the built-in WrapITK in ITK 3.14.0 there is indeed no  
> GetImageDimension.
>
> You can either upgrade to the new WrapITK 0.3.0 :), or, what I used to
> do, parse the "this" ivar of the image instance for the dimension.


In wrapitk 0.3.0, I can get the image dimension in the following ways.  
I'm sure the last one would work with previous wrapitk version too,  
without parsing anything :-)

[glehmann at marvin ~]$ ipython
1> import itk

2> img = itk.Image.UC3.New(Regions=(1024,1024,1024))

3> img.ImageDimension
3> 3

4> img.GetImageDimension()
4> 3

5> itk.template(img)[1][1]
5> 3

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/20090811/2016514d/attachment.pgp>


More information about the Insight-users mailing list