diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2020-06-23 15:19:06 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2020-07-02 15:54:12 +0200 |
commit | 492c0211608fa756ba6642ff7ae3b479765a955b (patch) | |
tree | 325b34d12f5969f7b90d6eaacb4d023e2a386213 /python/astra/utils.pyx | |
parent | ecfb65a05b8ed5171ad65173581d5fe328926995 (diff) | |
download | astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.gz astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.bz2 astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.xz astra-492c0211608fa756ba6642ff7ae3b479765a955b.zip |
Check numpy array type
Diffstat (limited to 'python/astra/utils.pyx')
-rw-r--r-- | python/astra/utils.pyx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx index 3b6e3ff..12fc38c 100644 --- a/python/astra/utils.pyx +++ b/python/astra/utils.pyx @@ -45,7 +45,7 @@ from .PyXMLDocument cimport XMLDocument from .PyXMLDocument cimport XMLNode from .PyIncludes cimport * -from .pythonutils import GPULink +from .pythonutils import GPULink, checkArrayForLink cdef extern from "CFloat32CustomPython.h": cdef cppclass CFloat32CustomPython: @@ -252,9 +252,10 @@ cdef CFloat32VolumeData3D* linkVolFromGeometry(CVolumeGeometry3D *pGeometry, dat data_shape = (data.z, data.y, data.x) if geom_shape != data_shape: raise ValueError( - "The dimensions of the data do not match those specified in the geometry.".format(data_shape, geom_shape)) + "The dimensions of the data do not match those specified in the geometry: {} != {}".format(data_shape, geom_shape)) if isinstance(data, np.ndarray): + checkArrayForLink(data) pCustom = <CFloat32CustomMemory*> new CFloat32CustomPython(data) pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry, pCustom) elif isinstance(data, GPULink): @@ -276,9 +277,10 @@ cdef CFloat32ProjectionData3D* linkProjFromGeometry(CProjectionGeometry3D *pGeom data_shape = (data.z, data.y, data.x) if geom_shape != data_shape: raise ValueError( - "The dimensions of the data do not match those specified in the geometry.".format(data_shape, geom_shape)) + "The dimensions of the data do not match those specified in the geometry: {} != {}".format(data_shape, geom_shape)) if isinstance(data, np.ndarray): + checkArrayForLink(data) pCustom = <CFloat32CustomMemory*> new CFloat32CustomPython(data) pDataObject3D = new CFloat32ProjectionData3DMemory(pGeometry, pCustom) elif isinstance(data, GPULink): |