[Insight-users] simpleitk error

Raghuram.O.S. raghuramos1987 at gmail.com
Wed Dec 21 19:44:30 EST 2011


Hi,

I'm trying to use simpleitk. I need to add two images of same size and
shape. i'm converting them to numpy arrays and adding to get a final numpy
array. When I try to convert that back to a simpleitk image i get this
error.

In [11]: imComb_0_2 = sitk.GetImageFromArray(npComb_0_2)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (7061, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ros/cpp_code/itkAdd/data/<ipython console> in <module>()

/media/sda5/home/ros/softwares/bio/SimpleITK/bin/SimpleITK-build/Wrapping/SimpleITK.pyc
in GetImageFromArray(arr)
    146     """Get a SimpleITK Image from a numpy array."""
    147
--> 148     return _SimpleITK._GetImageFromArray( arr )
    149
    150 class VectorBool(_object):

TypeError: 'numpy.ndarray' does not have the buffer interface

In [12]: imComb_0_2 = sitk.GetImageFromArray(npComb_0_2)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (7061, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ros/cpp_code/itkAdd/data/<ipython console> in <module>()

/media/sda5/home/ros/softwares/bio/SimpleITK/bin/SimpleITK-build/Wrapping/SimpleITK.pyc
in GetImageFromArray(arr)
    146     """Get a SimpleITK Image from a numpy array."""
    147
--> 148     return _SimpleITK._GetImageFromArray( arr )
    149
    150 class VectorBool(_object):

TypeError: 'numpy.ndarray' does not have the buffer interface


Can somebody help me with this? Thank you.

-- 
Regards,
Onti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111221/5ca6bd94/attachment.htm>


More information about the Insight-users mailing list