[Insight-users] Trouble with Python numarray
Harish M.V.
mvharish14988 at gmail.com
Sun Mar 6 02:51:02 EST 2011
Hello Everyone,
I'm trying out the Python wrapper for ITK.
I took the following code from one of the examples provided -
ImageToArray.py
*from InsightToolkit import *
from numarray import *
from sys import argv
reader = itkImageFileReaderUC2_New()
connector = itkPyBufferUC2_New()
reader.SetFileName( argv[1] )
reader.Update()
print "ready to convert image into array"
buffer = connector.GetArrayFromImage( reader.GetOutput() )
writer = itkImageFileWriterUC2_New()
writer.SetFileName( argv[2] )
print "ready to convert array into image"
writer.SetInput( connector.GetImageFromArray( buffer ) )
writer.Update()
*Unfortunately, this does not work. I get the following error:
Traceback (most recent call last):
File "SegBullEye.py", line 10, in <module>
connector = itkPyBufferUC2_New()
NameError: name 'itkPyBufferUC2_New' is not defined
I have compiled numarray and all the python stuff successfully using the
advanced options in cmake. I don't know what can be causing this problem.
Reading some old posts from 2005/2006, I gather that other people have had
the same issues - I can't make out if they were fixed, or how they were
fixed.
Please help.
Thanks in Anticipation,
Harish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110306/5ff30ce7/attachment.htm>
More information about the Insight-users
mailing list