Hello Everyone, <br><br>I'm trying out the Python wrapper for ITK. <br>I took the following code from one of the examples provided - ImageToArray.py<br><br><i>from InsightToolkit import *<br>from numarray import *<br>from sys import argv<br>
reader = itkImageFileReaderUC2_New()<br>connector = itkPyBufferUC2_New()<br>reader.SetFileName( argv[1] )<br>reader.Update()<br>print "ready to convert image into array"<br>buffer = connector.GetArrayFromImage( reader.GetOutput() )<br>
writer = itkImageFileWriterUC2_New()<br>writer.SetFileName( argv[2] )<br>print "ready to convert array into image"<br>writer.SetInput( connector.GetImageFromArray( buffer ) )<br>writer.Update()<br><br></i>Unfortunately, this does not work. I get the following error:<br>
<br><span style="color: rgb(255, 0, 0);">Traceback (most recent call last):</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> File "SegBullEye.py", line 10, in <module></span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> connector = itkPyBufferUC2_New()</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">NameError: name 'itkPyBufferUC2_New' is not defined</span><br>
<br>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. <br>
<br>Please help. <br><br>Thanks in Anticipation,<br>Harish<br><br>