summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/astra/__init__.py2
-rw-r--r--python/astra/experimental.pyx45
-rw-r--r--python/builder.py2
-rw-r--r--python/conda/astra-toolbox/meta.yaml8
-rw-r--r--python/conda/libastra/meta.yaml4
5 files changed, 45 insertions, 16 deletions
diff --git a/python/astra/__init__.py b/python/astra/__init__.py
index 5e52a1c..4675229 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.3'
+__version__ = '1.9.0dev'
import os
diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx
index 136165b..80dae9a 100644
--- a/python/astra/experimental.pyx
+++ b/python/astra/experimental.pyx
@@ -34,10 +34,15 @@ IF HAVE_CUDA==True:
from .PyIncludes cimport *
from libcpp.vector cimport vector
+ cdef extern from "astra/CompositeGeometryManager.h" namespace "astra::CCompositeGeometryManager::SJob":
+ cdef enum EMode:
+ MODE_SET = 0
+ MODE_ADD = 1
cdef extern from "astra/CompositeGeometryManager.h" namespace "astra":
cdef cppclass CCompositeGeometryManager:
- bool doFP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *])
- bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *])
+ bool doFP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *], EMode)
+ bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *], EMode)
+ bool doFDK(CProjector3D *, CFloat32VolumeData3D *, CFloat32ProjectionData3D *, bool, const float*, EMode)
cdef extern from *:
CFloat32VolumeData3D * dynamic_cast_vol_mem "dynamic_cast<astra::CFloat32VolumeData3D*>" (CFloat32Data3D * )
@@ -59,7 +64,7 @@ IF HAVE_CUDA==True:
cdef CProjector3DManager * manProj = <CProjector3DManager * >PyProjector3DManager.getSingletonPtr()
cdef CData3DManager * man3d = <CData3DManager * >PyData3DManager.getSingletonPtr()
- def do_composite(projector_id, vol_ids, proj_ids, t):
+ def do_composite(projector_id, vol_ids, proj_ids, mode, t):
cdef vector[CFloat32VolumeData3D *] vol
cdef CFloat32VolumeData3D * pVolObject
cdef CFloat32ProjectionData3D * pProjObject
@@ -81,14 +86,38 @@ IF HAVE_CUDA==True:
cdef CCompositeGeometryManager m
cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL
if t == "FP":
- if not m.doFP(projector, vol, proj):
+ if not m.doFP(projector, vol, proj, mode):
raise Exception("Failed to perform FP")
- else:
- if not m.doBP(projector, vol, proj):
+ elif t == "BP":
+ if not m.doBP(projector, vol, proj, mode):
raise Exception("Failed to perform BP")
+ else:
+ raise RuntimeError("internal error: wrong composite op type")
def do_composite_FP(projector_id, vol_ids, proj_ids):
- do_composite(projector_id, vol_ids, proj_ids, "FP")
+ do_composite(projector_id, vol_ids, proj_ids, MODE_SET, "FP")
def do_composite_BP(projector_id, vol_ids, proj_ids):
- do_composite(projector_id, vol_ids, proj_ids, "BP")
+ do_composite(projector_id, vol_ids, proj_ids, MODE_SET, "BP")
+
+ def accumulate_FP(projector_id, vol_id, proj_id):
+ do_composite(projector_id, [vol_id], [proj_id], MODE_ADD, "FP")
+ def accumulate_BP(projector_id, vol_id, proj_id):
+ do_composite(projector_id, [vol_id], [proj_id], MODE_ADD, "BP")
+ def accumulate_FDK(projector_id, vol_id, proj_id):
+ cdef CFloat32VolumeData3D * pVolObject
+ cdef CFloat32ProjectionData3D * pProjObject
+ pVolObject = dynamic_cast_vol_mem(man3d.get(vol_id))
+ if pVolObject == NULL:
+ raise Exception("Data object not found")
+ if not pVolObject.isInitialized():
+ raise Exception("Data object not initialized properly")
+ pProjObject = dynamic_cast_proj_mem(man3d.get(proj_id))
+ if pProjObject == NULL:
+ raise Exception("Data object not found")
+ if not pProjObject.isInitialized():
+ raise Exception("Data object not initialized properly")
+ cdef CCompositeGeometryManager m
+ cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL
+ if not m.doFDK(projector, pVolObject, pProjObject, False, NULL, MODE_ADD):
+ raise Exception("Failed to perform FDK")
diff --git a/python/builder.py b/python/builder.py
index 01f4203..310f3c3 100644
--- a/python/builder.py
+++ b/python/builder.py
@@ -71,7 +71,7 @@ for m in ext_modules:
'PythonPluginAlgorithm.cpp'))
setup(name='astra-toolbox',
- version='1.8.3',
+ version='1.9.0dev',
description='Python interface to the ASTRA Toolbox',
author='D.M. Pelt',
author_email='D.M.Pelt@cwi.nl',
diff --git a/python/conda/astra-toolbox/meta.yaml b/python/conda/astra-toolbox/meta.yaml
index 88a9172..b68a093 100644
--- a/python/conda/astra-toolbox/meta.yaml
+++ b/python/conda/astra-toolbox/meta.yaml
@@ -1,10 +1,10 @@
package:
name: astra-toolbox
- version: '1.8.3'
+ version: '1.9.0dev'
source:
git_url: https://github.com/astra-toolbox/astra-toolbox.git
- git_tag: v1.8.3
+ git_tag: master
build:
number: 0
@@ -28,14 +28,14 @@ requirements:
- numpy {{ numpy }}
- scipy
- six
- - libastra ==1.8.3
+ - libastra ==1.9.0dev
run:
- python
- {{ pin_compatible('numpy', max_pin='x.x') }}
- scipy
- six
- - libastra ==1.8.3
+ - libastra ==1.9.0dev
about:
diff --git a/python/conda/libastra/meta.yaml b/python/conda/libastra/meta.yaml
index e4622b7..2135376 100644
--- a/python/conda/libastra/meta.yaml
+++ b/python/conda/libastra/meta.yaml
@@ -1,10 +1,10 @@
package:
name: libastra
- version: '1.8.3'
+ version: '1.9.0dev'
source:
git_url: https://github.com/astra-toolbox/astra-toolbox.git
- git_tag: v1.8.3
+ git_tag: master
build:
number: 0