tags:

views:

31

answers:

1

I have a numpy array and want to convert it into an ITK image for further processing. How do I do this without using the PyBuffer extension to WrapITK. I can't use that because I get a bunch of errors when compiling:

.../ExternalProjects/PyBuffer/itkPyBuffer.txx: In static member function ‘static PyObject* itk::PyBuffer<TImage>::GetArrayFromImage(TImage*) [with TImage = itk::Image<float, 2u>]’:
.../ExternalProjects/PyBuffer/wrap_itkPyBufferPython.cxx:1397:   instantiated from here
.../ExternalProjects/PyBuffer/itkPyBuffer.txx:64: error: cannot convert ‘int*’ to ‘npy_intp*’ in argument passing

I could use an idea about either how to fix the compilation errors or another way to convert my python objects.

+1  A: 

Just change

int dimensions[ ImageDimension ];

to

npy_intp dimensions[ ImageDimension ];

and recompile.

tkerwin