From dd24cce853ff3b28035b8723ab271cafb4272917 Mon Sep 17 00:00:00 2001
From: Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>
Date: Fri, 22 Sep 2017 17:26:09 +0200
Subject: Remove duplicate creation of projector in opTomo

Thanks to @NathanielSix for the report.
---
 matlab/tools/opTomo.m | 2 --
 1 file changed, 2 deletions(-)

(limited to 'matlab')

diff --git a/matlab/tools/opTomo.m b/matlab/tools/opTomo.m
index 81de534..aed2f29 100644
--- a/matlab/tools/opTomo.m
+++ b/matlab/tools/opTomo.m
@@ -92,11 +92,9 @@ classdef opTomo < opSpot
                 if gpuEnabled
                     fp_alg = 'FP_CUDA';
                     bp_alg = 'BP_CUDA';
-                    proj_id = [];
                 else
                     fp_alg = 'FP';
                     bp_alg = 'BP';
-                    proj_id = astra_create_projector(type, proj_geom, vol_geom);
                 end
                 
                 % configuration for ASTRA fp algorithm
-- 
cgit v1.2.3


From ae9a45df6da93742d0edbbbc3d57e5497b119839 Mon Sep 17 00:00:00 2001
From: vincentvn <vincent.vn@gmail.com>
Date: Thu, 5 Oct 2017 13:48:01 +0200
Subject: added vol_geom and proj_geom to the properties (#120)

Add vol_geom and proj_geom to the properties

The opTomo operator has the volume and projection geometries as properties ( SetAccess = private, GetAccess = public ).
This way you can all easily access all information about the geometry if you passed the opTomo object to a function.
---
 matlab/tools/opTomo.m | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'matlab')

diff --git a/matlab/tools/opTomo.m b/matlab/tools/opTomo.m
index aed2f29..3ae1163 100644
--- a/matlab/tools/opTomo.m
+++ b/matlab/tools/opTomo.m
@@ -51,6 +51,8 @@ classdef opTomo < opSpot
     properties ( SetAccess = private, GetAccess = public )
         proj_size
         vol_size
+        proj_geom
+        vol_geom
     end % properties
     
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -127,6 +129,7 @@ classdef opTomo < opSpot
                 op.bp_alg_id   = bp_alg_id;
                 op.sino_id     = sino_id;
                 op.vol_id      = vol_id;
+                
             else
                 % 3D
                 % only gpu/cuda code for 3D
@@ -156,6 +159,8 @@ classdef opTomo < opSpot
             op.vol_size    = vol_size;
             op.cflag       = false;
             op.sweepflag   = false;
+            op.proj_geom   = proj_geom;
+            op.vol_geom   = vol_geom;
 
         end % opTomo - constructor
         
-- 
cgit v1.2.3


From 9c7d0f544b7a4dec54e9a75ea45b985ad7fac756 Mon Sep 17 00:00:00 2001
From: Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>
Date: Wed, 11 Oct 2017 14:48:22 +0200
Subject: Improve object creation error messages

---
 matlab/mex/astra_mex_algorithm_c.cpp   |  4 ++--
 matlab/mex/astra_mex_projector3d_c.cpp | 12 ++++++++++--
 matlab/mex/astra_mex_projector_c.cpp   | 12 ++++++++++--
 3 files changed, 22 insertions(+), 6 deletions(-)

(limited to 'matlab')

diff --git a/matlab/mex/astra_mex_algorithm_c.cpp b/matlab/mex/astra_mex_algorithm_c.cpp
index a9cd14b..f20f3a5 100644
--- a/matlab/mex/astra_mex_algorithm_c.cpp
+++ b/matlab/mex/astra_mex_algorithm_c.cpp
@@ -83,7 +83,7 @@ void astra_mex_algorithm_create(int nlhs, mxArray* plhs[], int nrhs, const mxArr
 	CAlgorithm* pAlg = CAlgorithmFactory::getSingleton().create(cfg->self.getAttribute("type"));
 	if (!pAlg) {
 		delete cfg;
-		mexErrMsgTxt("Unknown algorithm. \n");
+		mexErrMsgTxt("Unknown Algorithm. \n");
 		return;
 	}
 
@@ -91,7 +91,7 @@ void astra_mex_algorithm_create(int nlhs, mxArray* plhs[], int nrhs, const mxArr
 	if (!pAlg->initialize(*cfg)) {
 		delete cfg;
 		delete pAlg;
-		mexErrMsgTxt("Algorithm not initialized. \n");
+		mexErrMsgTxt("Unable to initialize Algorithm. \n");
 		return;
 	}
 	delete cfg;
diff --git a/matlab/mex/astra_mex_projector3d_c.cpp b/matlab/mex/astra_mex_projector3d_c.cpp
index 3135939..c5f2291 100644
--- a/matlab/mex/astra_mex_projector3d_c.cpp
+++ b/matlab/mex/astra_mex_projector3d_c.cpp
@@ -68,10 +68,18 @@ void astra_mex_projector3d_create(int nlhs, mxArray* plhs[], int nrhs, const mxA
 	Config* cfg = structToConfig("Projector3D", prhs[1]);
 
 	// create algorithm
-	CProjector3D* pProj = CProjector3DFactory::getSingleton().create(*cfg);
+	CProjector3D* pProj = CProjector3DFactory::getSingleton().create(cfg->self.getAttribute("type"));
 	if (pProj == NULL) {
 		delete cfg;
-		mexErrMsgTxt("Error creating Projector3D. \n");
+		mexErrMsgTxt("Unknown Projector3D. \n");
+		return;
+	}
+
+	// create algorithm
+	if (!pProj->initialize(*cfg)) {
+		delete cfg;
+		delete pProj;
+		mexErrMsgTxt("Unable to initialize Projector3D. \n");
 		return;
 	}
 	delete cfg;
diff --git a/matlab/mex/astra_mex_projector_c.cpp b/matlab/mex/astra_mex_projector_c.cpp
index 36a5704..5c2ba72 100644
--- a/matlab/mex/astra_mex_projector_c.cpp
+++ b/matlab/mex/astra_mex_projector_c.cpp
@@ -77,10 +77,18 @@ void astra_mex_projector_create(int nlhs, mxArray* plhs[], int nrhs, const mxArr
 	Config* cfg = structToConfig("Projector2D", prhs[1]);
 
 	// create algorithm
-	CProjector2D* pProj = CProjector2DFactory::getSingleton().create(*cfg);
+	CProjector2D* pProj = CProjector2DFactory::getSingleton().create(cfg->self.getAttribute("type"));
 	if (pProj == NULL) {
 		delete cfg;
-		mexErrMsgTxt("Error creating projector. \n");
+		mexErrMsgTxt("Unknown Projector2D. \n");
+		return;
+	}
+
+	// create algorithm
+	if (!pProj->initialize(*cfg)) {
+		delete cfg;
+		delete pProj;
+		mexErrMsgTxt("Unable to initialize Projector2D. \n");
 		return;
 	}
 	delete cfg;
-- 
cgit v1.2.3