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

Miller, James V (Research) millerjv at crd . ge . com
Thu, 18 Dec 2003 09:45:08 -0500


Charl, 

(Your recent Python message triggered a question as whether one of your
previous messages has been resolved).

I changed the Spacing and Origin types of an image to be Vector's and
Point's
respectively.  The GetSpacing() method should now return an itk::Vector.

Does this resolve your issue with the Python bindings?

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