summaryrefslogtreecommitdiffstats
path: root/python/astra/plugin.py
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-07-20 15:14:50 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:57:18 +0200
commite509cd013f691acded3dc0d87732ba5257cb0ae4 (patch)
tree20ee95929c1fd1d6b290480c64be9bc77612d25b /python/astra/plugin.py
parentd91b51f6d58003de84a9d6dd8189fceba0e81a5a (diff)
downloadastra-e509cd013f691acded3dc0d87732ba5257cb0ae4.tar.gz
astra-e509cd013f691acded3dc0d87732ba5257cb0ae4.tar.bz2
astra-e509cd013f691acded3dc0d87732ba5257cb0ae4.tar.xz
astra-e509cd013f691acded3dc0d87732ba5257cb0ae4.zip
Add ReconstructionAlgorithm2D/3D classes for plugins (matching C++ classes)
Diffstat (limited to 'python/astra/plugin.py')
-rw-r--r--python/astra/plugin.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/python/astra/plugin.py b/python/astra/plugin.py
index 4b32e6e..11cc5cc 100644
--- a/python/astra/plugin.py
+++ b/python/astra/plugin.py
@@ -26,6 +26,10 @@
from . import plugin_c as p
from . import log
+from . import data2d
+from . import data2d_c
+from . import data3d
+from . import projector
import inspect
import traceback
@@ -65,6 +69,29 @@ class base(object):
kwargs = dict((k,optDict[k]) for k in opt if k in optDict)
self.initialize(cfg, *args, **kwargs)
+class ReconstructionAlgorithm2D(base):
+
+ def astra_init(self, cfg):
+ self.pid = cfg['ProjectorId']
+ self.s = data2d.get_shared(cfg['ProjectionDataId'])
+ self.v = data2d.get_shared(cfg['ReconstructionDataId'])
+ self.vg = projector.volume_geometry(self.pid)
+ self.pg = projector.projection_geometry(self.pid)
+ if not data2d_c.check_compatible(cfg['ProjectionDataId'], self.pid):
+ raise ValueError("Projection data and projector not compatible")
+ if not data2d_c.check_compatible(cfg['ReconstructionDataId'], self.pid):
+ raise ValueError("Reconstruction data and projector not compatible")
+ super(ReconstructionAlgorithm2D,self).astra_init(cfg)
+
+class ReconstructionAlgorithm3D(base):
+
+ def astra_init(self, cfg):
+ self.s = data3d.get_shared(cfg['ProjectionDataId'])
+ self.v = data3d.get_shared(cfg['ReconstructionDataId'])
+ self.vg = data3d.get_geometry(cfg['ReconstructionDataId'])
+ self.pg = data3d.get_geometry(cfg['ProjectionDataId'])
+ super(ReconstructionAlgorithm3D,self).astra_init(cfg)
+
def register(className):
"""Register plugin with ASTRA.