summaryrefslogtreecommitdiffstats
path: root/python/astra
diff options
context:
space:
mode:
Diffstat (limited to 'python/astra')
-rw-r--r--python/astra/PyIncludes.pxd4
-rw-r--r--python/astra/algorithm_c.pyx17
2 files changed, 16 insertions, 5 deletions
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 = <CAlgorithmManager * >PyAlgorithmManager.getSingletonPtr()
cdef extern from *:
- CReconstructionAlgorithm2D * dynamic_cast_recAlg "dynamic_cast<astra::CReconstructionAlgorithm2D*>" (CAlgorithm * ) except NULL
+ CReconstructionAlgorithm2D * dynamic_cast_recAlg2D "dynamic_cast<astra::CReconstructionAlgorithm2D*>" (CAlgorithm * )
+ CReconstructionAlgorithm3D * dynamic_cast_recAlg3D "dynamic_cast<astra::CReconstructionAlgorithm3D*>" (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