diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-05-07 11:34:37 +0200 |
---|---|---|
committer | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-05-07 11:34:37 +0200 |
commit | f730efe78367e8fe8e589c2b43fb0886d384f5c8 (patch) | |
tree | 7609d9e24baad50d5d405b02560c44a13ffe0f79 /python/astra | |
parent | f69d9f6bc1704560518da3c30c46e495c0228aac (diff) | |
download | astra-f730efe78367e8fe8e589c2b43fb0886d384f5c8.tar.gz astra-f730efe78367e8fe8e589c2b43fb0886d384f5c8.tar.bz2 astra-f730efe78367e8fe8e589c2b43fb0886d384f5c8.tar.xz astra-f730efe78367e8fe8e589c2b43fb0886d384f5c8.zip |
Do not allow 1D input in Python link method
Diffstat (limited to 'python/astra')
-rw-r--r-- | python/astra/data2d_c.pyx | 10 | ||||
-rw-r--r-- | python/astra/data3d_c.pyx | 10 |
2 files changed, 4 insertions, 16 deletions
diff --git a/python/astra/data2d_c.pyx b/python/astra/data2d_c.pyx index 29548b5..4919bf2 100644 --- a/python/astra/data2d_c.pyx +++ b/python/astra/data2d_c.pyx @@ -78,14 +78,8 @@ def create(datatype, geometry, data=None, link=False): cdef CFloat32Data2D * pDataObject2D cdef CFloat32CustomMemory * pCustom - if link: - geomSize = geom_size(geometry) - if len(data.shape)==1: - if data.size!=reduce(operator.mul,geomSize): - raise Exception("The dimensions of the data do not match those specified in the geometry.") - else: - if data.shape!=geomSize: - raise Exception("The dimensions of the data do not match those specified in the geometry.") + 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) diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 30745b4..3b27ab7 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -69,14 +69,8 @@ def create(datatype,geometry,data=None, link=False): cdef CConeProjectionGeometry3D* pppGeometry cdef CFloat32CustomMemory * pCustom - if link: - geomSize = geom_size(geometry) - if len(data.shape)==1: - if data.size!=reduce(operator.mul,geomSize): - raise Exception("The dimensions of the data do not match those specified in the geometry.") - else: - if data.shape!=geomSize: - raise Exception("The dimensions of the data do not match those specified in the geometry.") + 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) |