[Insight-users] ITK Python Wrapping Examples
Charl P. Botha
c . p . botha at ewi . tudelft . nl
Tue, 29 Jul 2003 23:51:42 +0200
Hua Qian wrote:
> Final Registration Parameters
> Translation X = _90db2909_p_double
> Translation Y = _98db2909_p_double
>
> Is there anyway to print out the parameters in plain numbers?
This has to do with the way in which SWIG treats references, and
GetElement() is actually returning a C++ reference to the element in
question, which is why you see a _p_double.
For now, you can try something like:
finalParameters.get(0)
finalParameters.get(1)
or more generically for any _p_double:
DArray_getitem(finalParameters.GetElement(0), 0)
DArray_getitem(finalParameters.GetElement(1), 0)
This could perhaps be done automatically by adding a few typemaps to
itk.swg, but then one would lose the ability to SET an element on the
returned reference by making use of *Array_setitem().
--
charl p. botha http://cpbotha . net/ http://visualisation . tudelft . nl/