summaryrefslogtreecommitdiffstats
path: root/python/astra/data3d_c.pyx
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-05-08 14:02:41 +0200
committerWillem Jan Palenstijn <wjp@usecode.org>2015-05-08 14:02:41 +0200
commit5e25feb74f0d810af581db32fc5f9ed0560fa841 (patch)
tree13c78d5aa78fb300913d5b4855644e8b7abcd88b /python/astra/data3d_c.pyx
parentbf31003d74f538a9096ef5999b31b0daa58c38c9 (diff)
parentf730efe78367e8fe8e589c2b43fb0886d384f5c8 (diff)
downloadastra-5e25feb74f0d810af581db32fc5f9ed0560fa841.tar.gz
astra-5e25feb74f0d810af581db32fc5f9ed0560fa841.tar.bz2
astra-5e25feb74f0d810af581db32fc5f9ed0560fa841.tar.xz
astra-5e25feb74f0d810af581db32fc5f9ed0560fa841.zip
Merge pull request #58 from dmpelt/python-link-size-check
Check data size when using 'link' function in Python
Diffstat (limited to 'python/astra/data3d_c.pyx')
-rw-r--r--python/astra/data3d_c.pyx11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx
index 84472c1..3b27ab7 100644
--- a/python/astra/data3d_c.pyx
+++ b/python/astra/data3d_c.pyx
@@ -45,6 +45,13 @@ from .PyXMLDocument cimport XMLDocument
cimport utils
from .utils import wrap_from_bytes
+from .pythonutils import geom_size
+
+import operator
+
+from six.moves import reduce
+
+
cdef CData3DManager * man3d = <CData3DManager * >PyData3DManager.getSingletonPtr()
cdef extern from *:
@@ -61,6 +68,10 @@ def create(datatype,geometry,data=None, link=False):
cdef CFloat32Data3DMemory * pDataObject3D
cdef CConeProjectionGeometry3D* pppGeometry
cdef CFloat32CustomMemory * pCustom
+
+ if link and data.shape!=geom_size(geometry):
+ raise Exception("The dimensions of the data do not match those specified in the geometry.")
+
if datatype == '-vol':
cfg = utils.dictToConfig(six.b('VolumeGeometry'), geometry)
pGeometry = new CVolumeGeometry3D()