From 83dd0330d20a57f52956d8a08b01072807e24daf Mon Sep 17 00:00:00 2001 From: jakobsj Date: Wed, 7 Mar 2018 16:05:32 +0000 Subject: fix simple_demo for cpu fanbeam (#44) --- Wrappers/Python/ccpi/astra/astra_processors.py | 18 ++++++++++++++---- Wrappers/Python/test/simple_demo.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'Wrappers/Python') diff --git a/Wrappers/Python/ccpi/astra/astra_processors.py b/Wrappers/Python/ccpi/astra/astra_processors.py index 91612b1..c3127eb 100644 --- a/Wrappers/Python/ccpi/astra/astra_processors.py +++ b/Wrappers/Python/ccpi/astra/astra_processors.py @@ -37,8 +37,13 @@ class AstraForwardProjector(DataSetProcessor): # ASTRA projector, to be stored if device == 'cpu': - # Note that 'line' is only for parallel (2D) and only one option - self.setProjector(astra.create_projector('line', proj_geom, vol_geom) ) + # Note that 'line' only one option + if self.sinogram_geometry.geom_type == 'parallel': + self.setProjector(astra.create_projector('line', proj_geom, vol_geom) ) + elif self.sinogram_geometry.geom_type == 'cone': + self.setProjector(astra.create_projector('line_fanflat', proj_geom, vol_geom) ) + else: + NotImplemented elif device == 'gpu': self.setProjector(astra.create_projector('cuda', proj_geom, vol_geom) ) else: @@ -100,8 +105,13 @@ class AstraBackProjector(DataSetProcessor): # ASTRA projector, to be stored if device == 'cpu': - # Note that 'line' is only for parallel (2D) and only one option - self.setProjector(astra.create_projector('line', proj_geom, vol_geom) ) + # Note that 'line' only one option + if self.sinogram_geometry.geom_type == 'parallel': + self.setProjector(astra.create_projector('line', proj_geom, vol_geom) ) + elif self.sinogram_geometry.geom_type == 'cone': + self.setProjector(astra.create_projector('line_fanflat', proj_geom, vol_geom) ) + else: + NotImplemented elif device == 'gpu': self.setProjector(astra.create_projector('cuda', proj_geom, vol_geom) ) else: diff --git a/Wrappers/Python/test/simple_demo.py b/Wrappers/Python/test/simple_demo.py index 1046e7b..0bbb687 100644 --- a/Wrappers/Python/test/simple_demo.py +++ b/Wrappers/Python/test/simple_demo.py @@ -60,7 +60,7 @@ elif test_case==2: dist_center_detector=OrigDetec) # ASTRA operator using volume and sinogram geometries -Aop = AstraProjectorSimple(vg, pg, 'gpu') +Aop = AstraProjectorSimple(vg, pg, 'cpu') # Unused old astra projector without geometry # Aop_old = AstraProjector(det_w, det_num, SourceOrig, -- cgit v1.2.3