From 46eb9cce2bc172514096c761cd50b0fc74e6c8e6 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Mon, 2 Mar 2015 17:22:42 +0100 Subject: Make Python get_geometry code match Matlab (after 03a9dd972ada50eedb83386910cecf02fe8d0e35) --- python/astra/data3d.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'python/astra/data3d.py') diff --git a/python/astra/data3d.py b/python/astra/data3d.py index 33bde51..a2e9201 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -27,7 +27,7 @@ from . import data3d_c as d def create(datatype,geometry,data=None): """Create a 3D object. - + :param datatype: Data object type, '-vol' or '-sino'. :type datatype: :class:`string` :param geometry: Volume or projection geometry. @@ -35,67 +35,77 @@ def create(datatype,geometry,data=None): :param data: Data to fill the constructed object with, either a scalar or array. :type data: :class:`float` or :class:`numpy.ndarray` :returns: :class:`int` -- the ID of the constructed object. - + """ return d.create(datatype,geometry,data) def get(i): """Get a 3D object. - + :param i: ID of object to get. :type i: :class:`int` :returns: :class:`numpy.ndarray` -- The object data. - + """ return d.get(i) def get_shared(i): """Get a 3D object with memory shared between the ASTRA toolbox and numpy array. - + :param i: ID of object to get. :type i: :class:`int` :returns: :class:`numpy.ndarray` -- The object data. - + """ return d.get_shared(i) def get_single(i): """Get a 3D object in single precision. - + :param i: ID of object to get. :type i: :class:`int` :returns: :class:`numpy.ndarray` -- The object data. - + """ return g.get_single(i) def store(i,data): """Fill existing 3D object with data. - + :param i: ID of object to fill. :type i: :class:`int` :param data: Data to fill the object with, either a scalar or array. :type data: :class:`float` or :class:`numpy.ndarray` - + """ return d.store(i,data) +def get_geometry(i): + """Get the geometry of a 3D object. + + :param i: ID of object. + :type i: :class:`int` + :returns: :class:`dict` -- The geometry of object with ID ``i``. + + """ + return d.get_geometry(i) + def dimensions(i): """Get dimensions of a 3D object. - + :param i: ID of object. :type i: :class:`int` :returns: :class:`tuple` -- dimensions of object with ID ``i``. - + """ return d.dimensions(i) def delete(ids): """Delete a 2D object. - + :param ids: ID or list of ID's to delete. :type ids: :class:`int` or :class:`list` - + """ return d.delete(ids) -- cgit v1.2.3