[Insight-developers] itk::Image GetElement()/SetElement() unu sable from Python

Miller, James V (Research) millerjv at crd . ge . com
Fri, 5 Dec 2003 16:41:04 -0500


Charl,

We have discussed the need to have the spacing and origin 
for an Image be an itkFixedArray (actually origin should 
probably be an itkPoint).  The Set methods would then 
take an itkFixedArray and the GetMethods would return 
a const reference to a FixedArray.

This is something we should do.

Jim

-----Original Message-----
From: Charl P. Botha [mailto:c . p . botha at ewi . tudelft . nl]
Sent: Friday, December 05, 2003 10:27 AM
To: ITK Developers
Subject: [Insight-developers] itk::Image GetElement()/SetElement()
unusable from Python


Dear list,

itk::Image::GetElement() returns a double array (reference) and 
SetElement() takes a double array as parameter.  In Python-world, this 
results in the following:

 >>> import InsightToolkit as itk
 >>> a = itk.itkImageF2_New()
 >>> a.GetSpacing()
'_e80d7504_p_double'

This also means that I can't call SetSpacing() from Python.  Could we 
perhaps add a SetSpacing() overloaded for itk::Array<double> and a const 
GetSpacing()?  If these definitions are made before the existing ones, 
the wrapper will be able to bring them through to Python and they should 
be usable.  I also seem to recall from previous postings (with regards 
to itk::Array and GetElement) that non-const Getters were discouraged.

Any thoughts on this or alternative solutions?

Thanks,
Charl

-- 
charl p. botha http://cpbotha . net/ http://visualisation . tudelft . nl/




_______________________________________________
Insight-developers mailing list
Insight-developers at itk . org
http://www . itk . org/mailman/listinfo/insight-developers