summaryrefslogtreecommitdiffstats
path: root/matlab/tools
diff options
context:
space:
mode:
authorWim van Aarle <wimvanaarle@gmail.com>2015-03-03 18:22:23 +0100
committerWim van Aarle <wimvanaarle@gmail.com>2015-03-03 18:22:23 +0100
commita452bc6f1c450a7174ec257d052dfe3ce25b1623 (patch)
tree95da84f485a0235f4cf049717f953909f6bf3f37 /matlab/tools
parente468c6c546dbb4d9665ccb95b1571a160753d50e (diff)
downloadastra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.gz
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.bz2
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.xz
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.zip
created parallel_vec geometry class
Diffstat (limited to 'matlab/tools')
-rw-r--r--matlab/tools/astra_create_proj_geom.m13
-rw-r--r--matlab/tools/astra_geom_2vec.m26
2 files changed, 37 insertions, 2 deletions
diff --git a/matlab/tools/astra_create_proj_geom.m b/matlab/tools/astra_create_proj_geom.m
index 862e410..ff7d74d 100644
--- a/matlab/tools/astra_create_proj_geom.m
+++ b/matlab/tools/astra_create_proj_geom.m
@@ -107,6 +107,19 @@ if strcmp(type,'parallel')
'ProjectionAngles', varargin{3} ...
);
+elseif strcmp(type,'parallel_vec')
+ if numel(varargin) < 2
+ error('not enough variables: astra_create_proj_geom(parallel_vec, det_count, V')
+ end
+ if size(varargin{2}, 2) ~= 6
+ error('V should be a Nx6 matrix, with N the number of projections')
+ end
+ proj_geom = struct( ...
+ 'type', 'parallel_vec', ...
+ 'DetectorCount', varargin{1}, ...
+ 'Vectors', varargin{2} ...
+ );
+
elseif strcmp(type,'fanflat')
if numel(varargin) < 5
error('not enough variables: astra_create_proj_geom(fanflat, det_width, det_count, angles, source_origin, source_det)');
diff --git a/matlab/tools/astra_geom_2vec.m b/matlab/tools/astra_geom_2vec.m
index 0abd07c..c6dda0d 100644
--- a/matlab/tools/astra_geom_2vec.m
+++ b/matlab/tools/astra_geom_2vec.m
@@ -1,7 +1,29 @@
function proj_geom_out = astra_geom_2vec(proj_geom)
+ % PARALLEL 2D
+ if strcmp(proj_geom.type,'parallel')
+
+ vectors = zeros(numel(proj_geom.ProjectionAngles), 6);
+ for i = 1:numel(proj_geom.ProjectionAngles)
+
+ % ray direction
+ vectors(i,1) = sin(proj_geom.ProjectionAngles(i));
+ vectors(i,2) = -cos(proj_geom.ProjectionAngles(i));
+
+ % center of detector
+ vectors(i,3) = 0;
+ vectors(i,4) = 0;
+
+ % vector from detector pixel 0 to 1
+ vectors(i,5) = cos(proj_geom.ProjectionAngles(i)) * proj_geom.DetectorWidth;
+ vectors(i,6) = sin(proj_geom.ProjectionAngles(i)) * proj_geom.DetectorWidth;
+
+ end
+
+ proj_geom_out = astra_create_proj_geom('parallel_vec', proj_geom.DetectorCount, vectors);
+
% FANFLAT
- if strcmp(proj_geom.type,'fanflat')
+ elseif strcmp(proj_geom.type,'fanflat')
vectors = zeros(numel(proj_geom.ProjectionAngles), 6);
for i = 1:numel(proj_geom.ProjectionAngles)
@@ -50,7 +72,7 @@ function proj_geom_out = astra_geom_2vec(proj_geom)
proj_geom_out = astra_create_proj_geom('cone_vec', proj_geom.DetectorRowCount, proj_geom.DetectorColCount, vectors);
- % PARALLEL
+ % PARALLEL 3D
elseif strcmp(proj_geom.type,'parallel3d')
vectors = zeros(numel(proj_geom.ProjectionAngles), 12);