diff --git a/Modules/Bridge/NumPy/wrapping/PyBuffer.i.in b/Modules/Bridge/NumPy/wrapping/PyBuffer.i.in index 372e377aa8a..673f5c7f2c6 100644 --- a/Modules/Bridge/NumPy/wrapping/PyBuffer.i.in +++ b/Modules/Bridge/NumPy/wrapping/PyBuffer.i.in @@ -81,8 +81,8 @@ if not HAVE_NUMPY: raise ImportError('Numpy not available.') - assert ndarr.ndim in ( 2, 3, 4 ), \ - "Only arrays of 2, 3 or 4 dimensions are supported." + assert ndarr.ndim in ( 1, 2, 3, 4 ), \ + "Only arrays of 1, 2, 3 or 4 dimensions are supported." if not ndarr.flags['C_CONTIGUOUS'] and not ndarr.flags['F_CONTIGUOUS']: ndarr = np.ascontiguousarray(ndarr) @@ -91,7 +91,7 @@ imgview = itkPyBuffer@PyBufferTypes@._GetImageViewFromArray( ndarr, ndarr.shape[-2::-1], ndarr.shape[-1] ) else: imgview = itkPyBuffer@PyBufferTypes@._GetImageViewFromArray( ndarr, ndarr.shape[-1:0:-1], ndarr.shape[0] ) - elif ndarr.ndim in ( 2, 3 ): + elif ndarr.ndim in ( 1, 2, 3 ): imgview = itkPyBuffer@PyBufferTypes@._GetImageViewFromArray( ndarr, ndarr.shape[::-1], 1) # Keep a reference