From a02ee2a02aead0c69acfd15693fd12d0d5efd52f Mon Sep 17 00:00:00 2001 From: Allard Hendriksen Date: Wed, 11 Oct 2017 16:41:31 +0200 Subject: Improve python create_vol_geom Remove redundant window computations. Also fixes the problem where >> astra.create_vol_geom(10,10,10) would not set the window options while all other parameter configurations of create_vol_geom did set the window options. Respects custom arguments for the window. --- python/astra/creators.py | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'python/astra') diff --git a/python/astra/creators.py b/python/astra/creators.py index 53d98e0..1e4d937 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -81,37 +81,19 @@ This method can be called in a number of ways: if len(varargin) == 1 and isinstance(varargin[0], int) == 1: vol_geom['GridRowCount'] = varargin[0] vol_geom['GridColCount'] = varargin[0] - vol_geom['option']['WindowMinX'] = -varargin[0] / 2. - vol_geom['option']['WindowMaxX'] = varargin[0] / 2. - vol_geom['option']['WindowMinY'] = -varargin[0] / 2. - vol_geom['option']['WindowMaxY'] = varargin[0] / 2. # astra_create_vol_geom([row_count col_count]) elif len(varargin) == 1 and len(varargin[0]) == 2: vol_geom['GridRowCount'] = varargin[0][0] vol_geom['GridColCount'] = varargin[0][1] - vol_geom['option']['WindowMinX'] = -varargin[0][1] / 2. - vol_geom['option']['WindowMaxX'] = varargin[0][1] / 2. - vol_geom['option']['WindowMinY'] = -varargin[0][0] / 2. - vol_geom['option']['WindowMaxY'] = varargin[0][0] / 2. # astra_create_vol_geom([row_count col_count slice_count]) elif len(varargin) == 1 and len(varargin[0]) == 3: vol_geom['GridRowCount'] = varargin[0][0] vol_geom['GridColCount'] = varargin[0][1] vol_geom['GridSliceCount'] = varargin[0][2] - vol_geom['option']['WindowMinX'] = -varargin[0][1] / 2. - vol_geom['option']['WindowMaxX'] = varargin[0][1] / 2. - vol_geom['option']['WindowMinY'] = -varargin[0][0] / 2. - vol_geom['option']['WindowMaxY'] = varargin[0][0] / 2. - vol_geom['option']['WindowMinZ'] = -varargin[0][2] / 2. - vol_geom['option']['WindowMaxZ'] = varargin[0][2] / 2. # astra_create_vol_geom(row_count, col_count) elif len(varargin) == 2: vol_geom['GridRowCount'] = varargin[0] vol_geom['GridColCount'] = varargin[1] - vol_geom['option']['WindowMinX'] = -varargin[1] / 2. - vol_geom['option']['WindowMaxX'] = varargin[1] / 2. - vol_geom['option']['WindowMinY'] = -varargin[0] / 2. - vol_geom['option']['WindowMaxY'] = varargin[0] / 2. # astra_create_vol_geom(row_count, col_count, min_x, max_x, min_y, max_y) elif len(varargin) == 6: vol_geom['GridRowCount'] = varargin[0] @@ -136,6 +118,17 @@ This method can be called in a number of ways: vol_geom['option']['WindowMaxY'] = varargin[6] vol_geom['option']['WindowMinZ'] = varargin[7] vol_geom['option']['WindowMaxZ'] = varargin[8] + + # set the window options, if not set already. + if not 'WindowMinX' in vol_geom['option']: + vol_geom['option']['WindowMinX'] = -vol_geom['GridColCount'] / 2. + vol_geom['option']['WindowMaxX'] = vol_geom['GridColCount'] / 2. + vol_geom['option']['WindowMinY'] = -vol_geom['GridRowCount'] / 2. + vol_geom['option']['WindowMaxY'] = vol_geom['GridRowCount'] / 2. + if 'GridSliceCount' in vol_geom: + vol_geom['option']['WindowMinZ'] = -vol_geom['GridSliceCount'] / 2. + vol_geom['option']['WindowMaxZ'] = vol_geom['GridSliceCount'] / 2. + return vol_geom -- cgit v1.2.3 From 17ebcfefa7c42cff61a81bf12a915983b330ed15 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 17 Oct 2017 17:20:40 +0200 Subject: Add astra.astra.get_gpu_info utility function --- python/astra/astra.py | 10 ++++++++++ python/astra/astra_c.pyx | 9 +++++++++ 2 files changed, 19 insertions(+) (limited to 'python/astra') diff --git a/python/astra/astra.py b/python/astra/astra.py index 3804d51..434ccb9 100644 --- a/python/astra/astra.py +++ b/python/astra/astra.py @@ -45,6 +45,16 @@ def set_gpu_index(idx, memory=0): """ a.set_gpu_index(idx, memory) +def get_gpu_info(idx=-1): + """Get GPU info. + + :param idx: GPU index, or -1 for current device + :type idx: :class:`int` + :returns: :class:`str` -- GPU info + """ + return a.get_gpu_info(idx) + + def delete(ids): """Delete an astra object. diff --git a/python/astra/astra_c.pyx b/python/astra/astra_c.pyx index 6de10da..f39b0a1 100644 --- a/python/astra/astra_c.pyx +++ b/python/astra/astra_c.pyx @@ -42,9 +42,14 @@ cdef extern from "astra/Globals.h" namespace "astra": IF HAVE_CUDA==True: cdef extern from "../cuda/2d/darthelper.h" namespace "astraCUDA": bool setGPUIndex(int) + cdef extern from "../cuda/2d/util.h" namespace "astraCUDA": + string getCudaDeviceString(int) ELSE: def setGPUIndex(): pass + def getCudaDeviceString(idx): + pass + cdef extern from "astra/CompositeGeometryManager.h" namespace "astra": cdef cppclass SGPUParams: vector[int] GPUIndices @@ -85,9 +90,13 @@ IF HAVE_CUDA==True: ret = setGPUIndex(params.GPUIndices[0]) if not ret: six.print_("Failed to set GPU " + str(params.GPUIndices[0])) + def get_gpu_info(idx=-1): + return wrap_from_bytes(getCudaDeviceString(idx)) ELSE: def set_gpu_index(idx, memory=0): raise NotImplementedError("CUDA support is not enabled in ASTRA") + def get_gpu_info(idx=-1): + raise NotImplementedError("CUDA support is not enabled in ASTRA") def delete(ids): import collections -- cgit v1.2.3 From 8d8a3d26372d9c0a784e181121fc2b360f6fee51 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 31 Aug 2017 16:47:29 +0200 Subject: Add trailing ,/; to string repr of float vector/matrix This makes it possible to differentiate between a scalar and a one-element vector, and fixes #111. --- python/astra/utils.pyx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python/astra') diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx index a40916b..bcff6c3 100644 --- a/python/astra/utils.pyx +++ b/python/astra/utils.pyx @@ -171,6 +171,7 @@ def stringToPythonValue(inputIn): input = castString(inputIn) # matrix if ';' in input: + input = input.rstrip(';') row_strings = input.split(';') col_strings = row_strings[0].split(',') nRows = len(row_strings) @@ -185,6 +186,7 @@ def stringToPythonValue(inputIn): # vector if ',' in input: + input = input.rstrip(',') items = input.split(',') out = np.empty(len(items)) for idx,item in enumerate(items): -- cgit v1.2.3 From 71d27819b1b046109b5c70e3bd112f436e96a545 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 23 Oct 2017 12:14:28 +0200 Subject: Support 2d/3d in astra.algorithm.get_res_norm --- python/astra/PyIncludes.pxd | 4 ++++ python/astra/algorithm_c.pyx | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'python/astra') diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index c091963..512b82f 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -152,6 +152,10 @@ cdef extern from "astra/ReconstructionAlgorithm2D.h" namespace "astra": cdef cppclass CReconstructionAlgorithm2D: bool getResidualNorm(float32&) +cdef extern from "astra/ReconstructionAlgorithm3D.h" namespace "astra": + cdef cppclass CReconstructionAlgorithm3D: + bool getResidualNorm(float32&) + cdef extern from "astra/Projector2D.h" namespace "astra": cdef cppclass CProjector2D: bool isInitialized() diff --git a/python/astra/algorithm_c.pyx b/python/astra/algorithm_c.pyx index 9ed0634..161fe98 100644 --- a/python/astra/algorithm_c.pyx +++ b/python/astra/algorithm_c.pyx @@ -44,7 +44,8 @@ from .utils import wrap_from_bytes cdef CAlgorithmManager * manAlg = PyAlgorithmManager.getSingletonPtr() cdef extern from *: - CReconstructionAlgorithm2D * dynamic_cast_recAlg "dynamic_cast" (CAlgorithm * ) except NULL + CReconstructionAlgorithm2D * dynamic_cast_recAlg2D "dynamic_cast" (CAlgorithm * ) + CReconstructionAlgorithm3D * dynamic_cast_recAlg3D "dynamic_cast" (CAlgorithm * ) def create(config): @@ -79,12 +80,18 @@ def run(i, iterations=0): def get_res_norm(i): cdef CReconstructionAlgorithm2D * pAlg2D + cdef CReconstructionAlgorithm3D * pAlg3D cdef CAlgorithm * alg = getAlg(i) cdef float32 res = 0.0 - pAlg2D = dynamic_cast_recAlg(alg) - if pAlg2D == NULL: - raise Exception("Operation not supported.") - if not pAlg2D.getResidualNorm(res): + pAlg2D = dynamic_cast_recAlg2D(alg) + pAlg3D = dynamic_cast_recAlg3D(alg) + if pAlg2D != NULL: + if not pAlg2D.getResidualNorm(res): + raise Exception("Operation not supported.") + elif pAlg3D != NULL: + if not pAlg3D.getResidualNorm(res): + raise Exception("Operation not supported.") + else: raise Exception("Operation not supported.") return res -- cgit v1.2.3 From 42b5e731a9ac6c3aa4751cee2c09758d58d18427 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 23 Oct 2017 13:57:03 +0200 Subject: Fix usage of cython except --- python/astra/experimental.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python/astra') diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx index 0af3118..136165b 100644 --- a/python/astra/experimental.pyx +++ b/python/astra/experimental.pyx @@ -40,8 +40,8 @@ IF HAVE_CUDA==True: bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *]) cdef extern from *: - CFloat32VolumeData3D * dynamic_cast_vol_mem "dynamic_cast" (CFloat32Data3D * ) except NULL - CFloat32ProjectionData3D * dynamic_cast_proj_mem "dynamic_cast" (CFloat32Data3D * ) except NULL + CFloat32VolumeData3D * dynamic_cast_vol_mem "dynamic_cast" (CFloat32Data3D * ) + CFloat32ProjectionData3D * dynamic_cast_proj_mem "dynamic_cast" (CFloat32Data3D * ) cdef extern from "astra/Float32ProjectionData3D.h" namespace "astra": cdef cppclass CFloat32ProjectionData3D: -- cgit v1.2.3 From 642977e9d613d673fbf46e11cb92b6785fe02cc6 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 26 Oct 2017 11:01:36 +0200 Subject: Fix usage of cython except --- python/astra/data3d_c.pyx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'python/astra') diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 78ed620..0717ca0 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -60,7 +60,13 @@ cdef extern from "Python.h": cdef CData3DManager * man3d = PyData3DManager.getSingletonPtr() cdef extern from *: - CFloat32Data3DMemory * dynamic_cast_mem "dynamic_cast" (CFloat32Data3D * ) except NULL + CFloat32Data3DMemory * dynamic_cast_mem "dynamic_cast" (CFloat32Data3D * ) + +cdef CFloat32Data3DMemory * dynamic_cast_mem_safe(CFloat32Data3D *obj) except NULL: + cdef CFloat32Data3DMemory *ret = dynamic_cast_mem(obj) + if not ret: + raise RuntimeError("Not a memory 3D data object") + return ret cdef extern from "CFloat32CustomPython.h": cdef cppclass CFloat32CustomPython: @@ -154,12 +160,12 @@ def create(datatype,geometry,data=None, link=False): raise RuntimeError("Couldn't initialize data object.") if not link: - fillDataObject(dynamic_cast_mem(pDataObject3D), data) + fillDataObject(dynamic_cast_mem_safe(pDataObject3D), data) return man3d.store(pDataObject3D) def get_geometry(i): - cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem(getObject(i)) + cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) cdef CFloat32ProjectionData3DMemory * pDataObject2 cdef CFloat32VolumeData3DMemory * pDataObject3 if pDataObject.getType() == THREEPROJECTION: @@ -173,7 +179,7 @@ def get_geometry(i): return geom def change_geometry(i, geom): - cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem(getObject(i)) + cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) cdef CFloat32ProjectionData3DMemory * pDataObject2 cdef CFloat32VolumeData3DMemory * pDataObject3 if pDataObject.getType() == THREEPROJECTION: @@ -262,7 +268,7 @@ cdef CFloat32Data3D * getObject(i) except NULL: @cython.boundscheck(False) @cython.wraparound(False) def get(i): - cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem(getObject(i)) + cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) outArr = np.empty((pDataObject.getDepth(),pDataObject.getHeight(), pDataObject.getWidth()),dtype=np.float32,order='C') cdef float [:,:,::1] mView = outArr cdef float [:,:,::1] cView = pDataObject.getData3D()[0][0] @@ -270,7 +276,7 @@ def get(i): return outArr def get_shared(i): - cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem(getObject(i)) + cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) outArr = np.empty((pDataObject.getDepth(),pDataObject.getHeight(), pDataObject.getWidth()),dtype=np.float32,order='C') cdef np.npy_intp shape[3] shape[0] = pDataObject.getDepth() @@ -283,7 +289,7 @@ def get_single(i): def store(i,data): cdef CFloat32Data3D * pDataObject = getObject(i) - fillDataObject(dynamic_cast_mem(pDataObject), data) + fillDataObject(dynamic_cast_mem_safe(pDataObject), data) def dimensions(i): cdef CFloat32Data3D * pDataObject = getObject(i) -- cgit v1.2.3 From f70f68fcd465f421b566b199e23e66c1f186b01d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 1 Nov 2017 15:05:13 +0100 Subject: Separate cuda from astra headers further --- python/astra/astra_c.pyx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'python/astra') diff --git a/python/astra/astra_c.pyx b/python/astra/astra_c.pyx index f39b0a1..f25fc2a 100644 --- a/python/astra/astra_c.pyx +++ b/python/astra/astra_c.pyx @@ -40,9 +40,8 @@ cdef extern from "astra/Globals.h" namespace "astra": bool cudaEnabled() IF HAVE_CUDA==True: - cdef extern from "../cuda/2d/darthelper.h" namespace "astraCUDA": + cdef extern from "../cuda/2d/astra.h" namespace "astraCUDA": bool setGPUIndex(int) - cdef extern from "../cuda/2d/util.h" namespace "astraCUDA": string getCudaDeviceString(int) ELSE: def setGPUIndex(): -- cgit v1.2.3 From 355ee14464f76f7a506143ef44a9b5a5319c4951 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 17 Oct 2017 21:06:50 +0200 Subject: Move set_gpu_index, get_gpu_info from astra.astra to astra --- python/astra/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index b73fff5..d5aac44 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -27,6 +27,7 @@ from . import matlab as m from .creators import astra_dict,create_vol_geom, create_proj_geom, create_backprojection, create_sino, create_reconstruction, create_projector,create_sino3d_gpu, create_backprojection3d_gpu from .functions import data_op, add_noise_to_sino, clear, move_vol_geom from .extrautils import clipCircle +from .astra import set_gpu_index, get_gpu_info from . import data2d from . import astra from . import data3d @@ -45,4 +46,4 @@ import os if 'ASTRA_GPU_INDEX' in os.environ: L = [ int(x) for x in os.environ['ASTRA_GPU_INDEX'].split(',') ] - astra.set_gpu_index(L) + set_gpu_index(L) -- cgit v1.2.3 From 3eaebe8827db8ddf029fdb94ccda2b0af1385bec Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 17 Oct 2017 21:07:28 +0200 Subject: Add basic post-install python tests --- python/astra/__init__.py | 1 + python/astra/tests.py | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 python/astra/tests.py (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index d5aac44..8238a88 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -39,6 +39,7 @@ from . import plugin from . import plugins from . import log from .optomo import OpTomo +from .tests import test_noCUDA, test_CUDA __version__ = '1.8' diff --git a/python/astra/tests.py b/python/astra/tests.py new file mode 100644 index 0000000..32afd36 --- /dev/null +++ b/python/astra/tests.py @@ -0,0 +1,97 @@ +# ----------------------------------------------------------------------- +# Copyright: 2010-2017, iMinds-Vision Lab, University of Antwerp +# 2013-2017, CWI, Amsterdam +# +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ +# +# This file is part of the ASTRA Toolbox. +# +# +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . +# +# ----------------------------------------------------------------------- + +from __future__ import print_function, absolute_import + +def _basic_par2d_fp(type): + import astra + import numpy as np + vg = astra.create_vol_geom(2, 32) + pg = astra.create_proj_geom('parallel', 1, 32, [0]) + proj_id = astra.create_projector(type, pg, vg) + vol = np.random.rand(2, 32) + (sino_id, sino) = astra.create_sino(vol, proj_id) + astra.data2d.delete(sino_id) + astra.projector.delete(proj_id) + err = np.max(np.abs(sino[0,:] - np.sum(vol,axis=0))) + return err < 1e-6 + +def _basic_par3d_fp(): + import astra + import numpy as np + vg = astra.create_vol_geom(2, 32, 32) + pg = astra.create_proj_geom('parallel3d', 1, 1, 32, 32, [0]) + vol = np.random.rand(32, 2, 32) + (sino_id, sino) = astra.create_sino3d_gpu(vol, pg, vg) + astra.data3d.delete(sino_id) + err = np.max(np.abs(sino[:,0,:] - np.sum(vol,axis=1))) + return err < 1e-6 + + +def _basic_par2d(): + print("Testing basic CPU 2D functionality... ", end="") + if _basic_par2d_fp('line'): + print("Ok") + return True + else: + print("Error") + return False + +def _basic_par2d_cuda(): + print("Testing basic CUDA 2D functionality... ", end="") + if _basic_par2d_fp('cuda'): + print("Ok") + return True + else: + print("Error") + return False + +def _basic_par3d_cuda(): + print("Testing basic CUDA 3D functionality... ", end="") + if _basic_par3d_fp(): + print("Ok") + return True + else: + print("Error") + return False + +def test_noCUDA(): + """Perform a very basic functionality test, without CUDA""" + + ok = _basic_par2d() + if not ok: + raise RuntimeError("Test failed") + +def test_CUDA(): + """Perform a very basic functionality test, including CUDA""" + + import astra + print("Getting GPU info... ", end="") + print(astra.get_gpu_info()) + ok1 = _basic_par2d() + ok2 = _basic_par2d_cuda() + ok3 = _basic_par3d_cuda() + if not (ok1 and ok2 and ok3): + raise RuntimeError("Test failed") -- cgit v1.2.3 From bfceef4da377c32cd59d1e51efb9aa1a21c7f4bd Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 6 Nov 2017 14:40:01 +0100 Subject: Update version to 1.8.3 --- python/astra/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index 8238a88..5e52a1c 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -41,7 +41,7 @@ from . import log from .optomo import OpTomo from .tests import test_noCUDA, test_CUDA -__version__ = '1.8' +__version__ = '1.8.3' import os -- cgit v1.2.3 From bd2798bed2fddfe00dac006013a9fb1363417f20 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 14 Nov 2017 14:56:02 +0100 Subject: Remove unused code --- python/astra/PyIncludes.pxd | 1 - python/astra/data3d_c.pyx | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'python/astra') diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index 512b82f..ec37d0a 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -211,7 +211,6 @@ cdef extern from "astra/Float32Data3DMemory.h" namespace "astra": CFloat32Data3DMemory() void updateStatistics() float32 *getData() - float32 ***getData3D() THREEEDataType getType() diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 0717ca0..897634b 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -254,7 +254,7 @@ cdef fillDataObjectScalar(CFloat32Data3DMemory * obj, float s): @cython.boundscheck(False) @cython.wraparound(False) cdef fillDataObjectArray(CFloat32Data3DMemory * obj, float [:,:,::1] data): - cdef float [:,:,::1] cView = obj.getData3D()[0][0] + cdef float [:,:,::1] cView = obj.getData() cView[:] = data cdef CFloat32Data3D * getObject(i) except NULL: @@ -271,7 +271,7 @@ def get(i): cdef CFloat32Data3DMemory * pDataObject = dynamic_cast_mem_safe(getObject(i)) outArr = np.empty((pDataObject.getDepth(),pDataObject.getHeight(), pDataObject.getWidth()),dtype=np.float32,order='C') cdef float [:,:,::1] mView = outArr - cdef float [:,:,::1] cView = pDataObject.getData3D()[0][0] + cdef float [:,:,::1] cView = pDataObject.getData() mView[:] = cView return outArr @@ -282,7 +282,7 @@ def get_shared(i): shape[0] = pDataObject.getDepth() shape[1] = pDataObject.getHeight() shape[2] = pDataObject.getWidth() - return np.PyArray_SimpleNewFromData(3,shape,np.NPY_FLOAT32,pDataObject.getData3D()[0][0]) + return np.PyArray_SimpleNewFromData(3,shape,np.NPY_FLOAT32,pDataObject.getData()) def get_single(i): raise NotImplementedError("Not yet implemented") -- cgit v1.2.3