diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/astra/PyIncludes.pxd | 2 | ||||
-rw-r--r-- | python/astra/PyProjector2DFactory.pxd | 2 | ||||
-rw-r--r-- | python/astra/PyProjector3DFactory.pxd | 2 | ||||
-rw-r--r-- | python/astra/algorithm_c.pyx | 4 | ||||
-rw-r--r-- | python/astra/projector3d_c.pyx | 8 | ||||
-rw-r--r-- | python/astra/projector_c.pyx | 8 |
6 files changed, 18 insertions, 8 deletions
diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index cf3f902..bba47f3 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -159,6 +159,7 @@ cdef extern from "astra/ReconstructionAlgorithm2D.h" namespace "astra": cdef extern from "astra/Projector2D.h" namespace "astra": cdef cppclass CProjector2D: bool isInitialized() + bool initialize(Config) CProjectionGeometry2D* getProjectionGeometry() CVolumeGeometry2D* getVolumeGeometry() CSparseMatrix* getMatrix() @@ -166,6 +167,7 @@ cdef extern from "astra/Projector2D.h" namespace "astra": cdef extern from "astra/Projector3D.h" namespace "astra": cdef cppclass CProjector3D: bool isInitialized() + bool initialize(Config) CProjectionGeometry3D* getProjectionGeometry() CVolumeGeometry3D* getVolumeGeometry() diff --git a/python/astra/PyProjector2DFactory.pxd b/python/astra/PyProjector2DFactory.pxd index 8c751fc..b70bf79 100644 --- a/python/astra/PyProjector2DFactory.pxd +++ b/python/astra/PyProjector2DFactory.pxd @@ -29,7 +29,7 @@ from .PyIncludes cimport * cdef extern from "astra/AstraObjectFactory.h" namespace "astra": cdef cppclass CProjector2DFactory: - CProjector2D *create(Config) + CProjector2D *create(string) cdef extern from "astra/AstraObjectFactory.h" namespace "astra::CProjector2DFactory": cdef CProjector2DFactory* getSingletonPtr() diff --git a/python/astra/PyProjector3DFactory.pxd b/python/astra/PyProjector3DFactory.pxd index 345678b..ae0cc1d 100644 --- a/python/astra/PyProjector3DFactory.pxd +++ b/python/astra/PyProjector3DFactory.pxd @@ -29,7 +29,7 @@ from .PyIncludes cimport * cdef extern from "astra/AstraObjectFactory.h" namespace "astra": cdef cppclass CProjector3DFactory: - CProjector3D *create(Config) + CProjector3D *create(string) cdef extern from "astra/AstraObjectFactory.h" namespace "astra::CProjector3DFactory": cdef CProjector3DFactory* getSingletonPtr() diff --git a/python/astra/algorithm_c.pyx b/python/astra/algorithm_c.pyx index 0a48de8..9ed0634 100644 --- a/python/astra/algorithm_c.pyx +++ b/python/astra/algorithm_c.pyx @@ -53,11 +53,11 @@ def create(config): alg = PyAlgorithmFactory.getSingletonPtr().create(cfg.self.getAttribute(six.b('type'))) if alg == NULL: del cfg - raise Exception("Unknown algorithm.") + raise Exception("Unknown Algorithm.") if not alg.initialize(cfg[0]): del cfg del alg - raise Exception("Algorithm not initialized.") + raise Exception("Unable to initialize Algorithm.") del cfg return manAlg.store(alg) diff --git a/python/astra/projector3d_c.pyx b/python/astra/projector3d_c.pyx index 98eccc1..7184535 100644 --- a/python/astra/projector3d_c.pyx +++ b/python/astra/projector3d_c.pyx @@ -53,10 +53,14 @@ IF HAVE_CUDA: def create(config): cdef Config * cfg = utils.dictToConfig(six.b('Projector3D'), config) cdef CProjector3D * proj - proj = PyProjector3DFactory.getSingletonPtr().create(cfg[0]) + proj = PyProjector3DFactory.getSingletonPtr().create(cfg.self.getAttribute(six.b('type'))) if proj == NULL: del cfg - raise Exception("Error creating Projector3D.") + raise Exception("Unknown Projector3D type.") + if not proj.initialize(cfg[0]): + del cfg + del proj + raise Exception("Unable to initialize Projector3D.") del cfg return manProj.store(proj) diff --git a/python/astra/projector_c.pyx b/python/astra/projector_c.pyx index be529da..ddd59a5 100644 --- a/python/astra/projector_c.pyx +++ b/python/astra/projector_c.pyx @@ -57,10 +57,14 @@ IF HAVE_CUDA: def create(config): cdef Config * cfg = utils.dictToConfig(six.b('Projector2D'), config) cdef CProjector2D * proj - proj = PyProjector2DFactory.getSingletonPtr().create(cfg[0]) + proj = PyProjector2DFactory.getSingletonPtr().create(cfg.self.getAttribute(six.b('type'))) if proj == NULL: del cfg - raise Exception("Error creating projector.") + raise Exception("Unknown Projector2D.") + if not proj.initialize(cfg[0]): + del cfg + del proj + raise Exception("Unable to initialize Projector2D.") del cfg return manProj.store(proj) |