[Insight-users] Can't create PoinSet type - WrapITK Python

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Mon Jul 6 17:55:27 EDT 2009


Le 6 juil. 09 à 23:26, Carlos Moro a écrit :

> Hi!
>

Hi Carlos,

> Thank you so much, Luis, it worked perfectly :)

I'm a bit late :-)
To complete what Luis said: you can find the available types by  
yourself by calling the "keys()" method on the templated class. For  
example, "itk.PointSet.keys()" returns

[(<class 'itkPointPython.itkPointD3'>,
   3,
   <class  
'itkDefaultStaticMeshTraitsPython.itkDefaultStaticMeshTraitsD33DD'>),
  (<class 'itkPointPython.itkPointD2'>,
   2,
   <class  
'itkDefaultStaticMeshTraitsPython.itkDefaultStaticMeshTraitsD22DD'>),
  (<itkCType double>,
   3,
   <class  
'itkDefaultDynamicMeshTraitsPython.itkDefaultDynamicMeshTraitsD33D'>),
  (<itkCType double>,
   2,
   <class  
'itkDefaultStaticMeshTraitsPython.itkDefaultStaticMeshTraitsD22D'>),
  (<itkCType double>,
   2,
   <class  
'itkDefaultDynamicMeshTraitsPython.itkDefaultDynamicMeshTraitsD22D'>),
  (<itkCType double>,
   3,
   <class  
'itkDefaultStaticMeshTraitsPython.itkDefaultStaticMeshTraitsD33D'>)]

on my host. If you prefer a shorter notation, you can look at the  
available members with "dir(itk.PointSet)". Again, on my host:

['D2D',
  'D2S',
  'D3D',
  'D3S',
  'New',
  'PD22S',
  'PD33S',
  '__add__',
<snip>
  'keys',
  'values']


>
> I would like to ask another question. How does one use in WrapITK- 
> Python functions that require passing a pointer, like:
>
>    pointExists =  pointsSet.GetPoint(1, pp)
>
>  What should be pp? If pp = [], I get:
>
>    pointExists =  pointsSet.GetPoint(1, pp)
>      File "/usr/lib/WrapITK/lib/itkPointSet.py", line 1196, in  
> GetPoint
>        def GetPoint(*args): return  
> _itkPointSet.itkPointSetD3S_Pointer_GetPoint(*args)
>    TypeError: Expected a pointer


You can use GetPointer():

   pointExists =  pointsSet.GetPoint(1, pp.GetPointer())

Or you can use WrapITK from googlecode - GetPointer() is not required  
anymore in such situation with that version.

   http://code.google.com/p/wrapitk/

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/20090706/19658237/attachment.pgp>


More information about the Insight-users mailing list