From b2fc6c70434674d74551c3a6c01ffb3233499312 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 1 Jul 2013 22:34:11 +0000 Subject: Update version to 1.3 --- matlab/tools/createOrderART.m | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 matlab/tools/createOrderART.m (limited to 'matlab/tools/createOrderART.m') diff --git a/matlab/tools/createOrderART.m b/matlab/tools/createOrderART.m new file mode 100644 index 0000000..a469d8a --- /dev/null +++ b/matlab/tools/createOrderART.m @@ -0,0 +1,66 @@ +function rayOrder = createOrderART(proj_geom, mode) + +%------------------------------------------------------------------------ +% rayOrder = createOrderART(proj_geom, mode) +% +% Creates an array defining the order in which ART will iterate over the +% projections and projection rays +% +% proj_geom: MATLAB struct containing the projection geometry. +% mode: string defining the wanted ray order, can be either 'sequential', +% 'randomray' or 'randomproj'. +% rayOrder: array of two columns of length angle_count * det_count, with +% the first column being the index of the projection and the second column +% the index of the ray. +%------------------------------------------------------------------------ +%------------------------------------------------------------------------ +% This file is part of the +% All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA-Toolbox") +% +% Copyright: iMinds-Vision Lab, University of Antwerp +% License: Open Source under GPLv3 +% Contact: mailto:astra@ua.ac.be +% Website: http://astra.ua.ac.be +%------------------------------------------------------------------------ +% $Id$ + +angle_count = length(proj_geom.projection_angles); +det_count = proj_geom.detector_count; + +% create order +rayOrder = zeros(angle_count * det_count, 2); +if strcmp(mode,'sequential') == 1 + index = 1; + for i = 1:angle_count + for j = 1:det_count + rayOrder(index,1) = i; + rayOrder(index,2) = j; + index = index + 1; + end + end +elseif strcmp(mode,'randomray') == 1 + index = 1; + for i = 1:angle_count + for j = 1:det_count + rayOrder(index,1) = i; + rayOrder(index,2) = j; + index = index + 1; + end + end + r = randperm(angle_count * det_count); + rayOrder(:,1) = rayOrder(r,1); + rayOrder(:,2) = rayOrder(r,2); +elseif strcmp(mode,'randomproj') == 1 + index = 1; + r = randperm(angle_count); + for i = 1:angle_count + for j = 1:det_count + rayOrder(index,1) = r(i); + rayOrder(index,2) = j; + index = index + 1; + end + end +else + disp('mode not known'); +end + -- cgit v1.2.3