Hi Matt,<div><br></div><div>I'm using python version 2.6.5. But this was in an ipython console which is on version 0.10 .<br><br><div class="gmail_quote">On Wed, Dec 21, 2011 at 10:02 PM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Onti,<br>
<br>
What version of Python are you using? You will need 2.6 or better for<br>
the required buffer protocol.<br>
<br>
Thanks,<br>
Matt<br>
<div><div class="h5"><br>
On Wed, Dec 21, 2011 at 7:44 PM, Raghuram.O.S. <<a href="mailto:raghuramos1987@gmail.com">raghuramos1987@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I'm trying to use simpleitk. I need to add two images of same size and<br>
> shape. i'm converting them to numpy arrays and adding to get a final numpy<br>
> array. When I try to convert that back to a simpleitk image i get this<br>
> error.<br>
><br>
> In [11]: imComb_0_2 = sitk.GetImageFromArray(npComb_0_2)<br>
> ERROR: An unexpected error occurred while tokenizing input<br>
> The following traceback may be corrupted or invalid<br>
> The error message is: ('EOF in multi-line statement', (7061, 0))<br>
><br>
> ---------------------------------------------------------------------------<br>
> TypeError Traceback (most recent call last)<br>
><br>
> /home/ros/cpp_code/itkAdd/data/<ipython console> in <module>()<br>
><br>
> /media/sda5/home/ros/softwares/bio/SimpleITK/bin/SimpleITK-build/Wrapping/SimpleITK.pyc<br>
> in GetImageFromArray(arr)<br>
> 146 """Get a SimpleITK Image from a numpy array."""<br>
> 147<br>
> --> 148 return _SimpleITK._GetImageFromArray( arr )<br>
> 149<br>
> 150 class VectorBool(_object):<br>
><br>
> TypeError: 'numpy.ndarray' does not have the buffer interface<br>
><br>
> In [12]: imComb_0_2 = sitk.GetImageFromArray(npComb_0_2)<br>
> ERROR: An unexpected error occurred while tokenizing input<br>
> The following traceback may be corrupted or invalid<br>
> The error message is: ('EOF in multi-line statement', (7061, 0))<br>
><br>
> ---------------------------------------------------------------------------<br>
> TypeError Traceback (most recent call last)<br>
><br>
> /home/ros/cpp_code/itkAdd/data/<ipython console> in <module>()<br>
><br>
> /media/sda5/home/ros/softwares/bio/SimpleITK/bin/SimpleITK-build/Wrapping/SimpleITK.pyc<br>
> in GetImageFromArray(arr)<br>
> 146 """Get a SimpleITK Image from a numpy array."""<br>
> 147<br>
> --> 148 return _SimpleITK._GetImageFromArray( arr )<br>
> 149<br>
> 150 class VectorBool(_object):<br>
><br>
> TypeError: 'numpy.ndarray' does not have the buffer interface<br>
><br>
><br>
> Can somebody help me with this? Thank you.<br>
><br>
> --<br>
> Regards,<br>
> Onti<br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Onti<br>
</div>