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

Charl P. Botha c . p . botha at ewi . tudelft . nl
Fri, 05 Dec 2003 16:27:16 +0100


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/