pyelastix
pyelastix copied to clipboard
BufferError: memoryview: underlying buffer is not C-contiguous
I'm getting "BufferError: memoryview: underlying buffer is not C-contiguous" when running pyelastix.register on two numpy arrays. Any ideas?
Try to use numpy.ascontiguousarray
beforehand - https://docs.scipy.org/doc/numpy/reference/generated/numpy.ascontiguousarray.html.
We need to sanitize the inputs, anyway.
Even if you use np.ascontigousarray beforehand, you can get that error on writing the data file, specially for huge images. pyelastix code should convert the array into contigous before writting the image back:#
Write data file f = open(fname_raw, 'wb') try: f.write(im.data) except: f.write(np.ascontiguousarray(im.data)) finally: f.close()
Closed by #23
Thanks Almar,
Remember that you still need to make the input arrays contiguous. I only updated the output array
On Thu, Apr 2, 2020, 10:00 AM Almar Klein [email protected] wrote:
Closed #14 https://github.com/almarklein/pyelastix/issues/14.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/almarklein/pyelastix/issues/14#event-3191019531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5BPMGT6ZNVP4KROVTHSJ3RKRA3VANCNFSM4GGEW7MA .
Remember that you still need to make the input arrays contiguous. I only updated the output array
Thanks for the clearification @samtzai! Let's re-open.