diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/astra/astra_c.pyx | 28 | ||||
-rw-r--r-- | python/astra/experimental.pyx | 96 |
2 files changed, 62 insertions, 62 deletions
diff --git a/python/astra/astra_c.pyx b/python/astra/astra_c.pyx index 342a214..6b246b6 100644 --- a/python/astra/astra_c.pyx +++ b/python/astra/astra_c.pyx @@ -45,21 +45,19 @@ ELSE: pass def credits(): - six.print_(""" -All Scale Tomographic Reconstruction Antwerp Toolbox (ASTRA-Toolbox) -was developed at the University of Antwerp by - * Prof. dr. Joost Batenburg - * Andrei Dabravolski - * Gert Merckx - * Willem Jan Palenstijn - * Tom Roelandts - * Prof. dr. Jan Sijbers - * dr. Wim van Aarle - * Sander van der Maar - * dr. Gert Van Gompel - -Python interface written by - * Daniel M. Pelt (CWI, Amsterdam)""") + six.print_("""The ASTRA Toolbox has been developed at the University of Antwerp and CWI, Amsterdam by + * Prof. dr. Joost Batenburg + * Prof. dr. Jan Sijbers + * Dr. Jeroen Bedorf + * Dr. Folkert Bleichrodt + * Dr. Andrei Dabravolski + * Dr. Willem Jan Palenstijn + * Dr. Tom Roelandts + * Dr. Wim van Aarle + * Dr. Gert Van Gompel + * Sander van der Maar, MSc. + * Gert Merckx, MSc. + * Daan Pelt, MSc.""") def use_cuda(): diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx index da27504..aafc002 100644 --- a/python/astra/experimental.pyx +++ b/python/astra/experimental.pyx @@ -28,57 +28,59 @@ include "config.pxi" -import six -from .PyIncludes cimport * -from libcpp.vector cimport vector +IF HAVE_CUDA==True: -cdef extern from "astra/CompositeGeometryManager.h" namespace "astra": - cdef cppclass CCompositeGeometryManager: - bool doFP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) - bool doBP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) + import six + from .PyIncludes cimport * + from libcpp.vector cimport vector -cdef extern from *: - CFloat32VolumeData3DMemory * dynamic_cast_vol_mem "dynamic_cast<astra::CFloat32VolumeData3DMemory*>" (CFloat32Data3D * ) except NULL - CFloat32ProjectionData3DMemory * dynamic_cast_proj_mem "dynamic_cast<astra::CFloat32ProjectionData3DMemory*>" (CFloat32Data3D * ) except NULL + cdef extern from "astra/CompositeGeometryManager.h" namespace "astra": + cdef cppclass CCompositeGeometryManager: + bool doFP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) + bool doBP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) -cimport PyProjector3DManager -from .PyProjector3DManager cimport CProjector3DManager -cimport PyData3DManager -from .PyData3DManager cimport CData3DManager + cdef extern from *: + CFloat32VolumeData3DMemory * dynamic_cast_vol_mem "dynamic_cast<astra::CFloat32VolumeData3DMemory*>" (CFloat32Data3D * ) except NULL + CFloat32ProjectionData3DMemory * dynamic_cast_proj_mem "dynamic_cast<astra::CFloat32ProjectionData3DMemory*>" (CFloat32Data3D * ) except NULL -cdef CProjector3DManager * manProj = <CProjector3DManager * >PyProjector3DManager.getSingletonPtr() -cdef CData3DManager * man3d = <CData3DManager * >PyData3DManager.getSingletonPtr() + cimport PyProjector3DManager + from .PyProjector3DManager cimport CProjector3DManager + cimport PyData3DManager + from .PyData3DManager cimport CData3DManager -def do_composite(projector_id, vol_ids, proj_ids, t): - cdef vector[CFloat32VolumeData3DMemory *] vol - cdef CFloat32VolumeData3DMemory * pVolObject - cdef CFloat32ProjectionData3DMemory * pProjObject - for v in vol_ids: - pVolObject = dynamic_cast_vol_mem(man3d.get(v)) - if pVolObject == NULL: - raise Exception("Data object not found") - if not pVolObject.isInitialized(): - raise Exception("Data object not initialized properly") - vol.push_back(pVolObject) - cdef vector[CFloat32ProjectionData3DMemory *] proj - for v in proj_ids: - pProjObject = dynamic_cast_proj_mem(man3d.get(v)) - if pProjObject == NULL: - raise Exception("Data object not found") - if not pProjObject.isInitialized(): - raise Exception("Data object not initialized properly") - proj.push_back(pProjObject) - cdef CCompositeGeometryManager m - cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL - if t == "FP": - if not m.doFP(projector, vol, proj): - raise Exception("Failed to perform FP") - else: - if not m.doBP(projector, vol, proj): - raise Exception("Failed to perform BP") + cdef CProjector3DManager * manProj = <CProjector3DManager * >PyProjector3DManager.getSingletonPtr() + cdef CData3DManager * man3d = <CData3DManager * >PyData3DManager.getSingletonPtr() -def do_composite_FP(projector_id, vol_ids, proj_ids): - do_composite(projector_id, vol_ids, proj_ids, "FP") + def do_composite(projector_id, vol_ids, proj_ids, t): + cdef vector[CFloat32VolumeData3DMemory *] vol + cdef CFloat32VolumeData3DMemory * pVolObject + cdef CFloat32ProjectionData3DMemory * pProjObject + for v in vol_ids: + pVolObject = dynamic_cast_vol_mem(man3d.get(v)) + if pVolObject == NULL: + raise Exception("Data object not found") + if not pVolObject.isInitialized(): + raise Exception("Data object not initialized properly") + vol.push_back(pVolObject) + cdef vector[CFloat32ProjectionData3DMemory *] proj + for v in proj_ids: + pProjObject = dynamic_cast_proj_mem(man3d.get(v)) + if pProjObject == NULL: + raise Exception("Data object not found") + if not pProjObject.isInitialized(): + raise Exception("Data object not initialized properly") + proj.push_back(pProjObject) + cdef CCompositeGeometryManager m + cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL + if t == "FP": + if not m.doFP(projector, vol, proj): + raise Exception("Failed to perform FP") + else: + if not m.doBP(projector, vol, proj): + raise Exception("Failed to perform BP") -def do_composite_BP(projector_id, vol_ids, proj_ids): - do_composite(projector_id, vol_ids, proj_ids, "BP") + def do_composite_FP(projector_id, vol_ids, proj_ids): + do_composite(projector_id, vol_ids, proj_ids, "FP") + + def do_composite_BP(projector_id, vol_ids, proj_ids): + do_composite(projector_id, vol_ids, proj_ids, "BP") |