Going from numpy array to itk Image

Posted by tkerwin on Stack Overflow See other posts from Stack Overflow or by tkerwin
Published on 2010-10-27T23:17:59Z Indexed on 2014/08/23 4:20 UTC
Read the original article Hit count: 100

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy