Skip to content
Snippets Groups Projects
Commit 8759f5d5 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Trivial formatting

parent 28ef5566
No related branches found
No related tags found
No related merge requests found
......@@ -26,11 +26,11 @@ function volume = gtAstra3D(~, ~, ~, proj)
% Version 002 26-09-2012 by LNervo
% Formatting, cleaning, commenting
OK = gtCheckGpu();
if ~OK
mexc = MException('ASTRA:no_GPU','gtAstra3D: Submit this job on a GPU machine ! Exiting...');
mexc = MException('ASTRA:no_GPU', ...
'gtAstra3D: Submit this job on a GPU machine ! Exiting...');
throw(mexc)
else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -67,7 +67,6 @@ else
volume = astra_mex_data3d('get', vol_id);
% vol is now a 3d "matrix" of size [x,y,z]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% clean up
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
......@@ -18,11 +18,10 @@ end
projname = fullfile(parameters.acq.dir, 'absorption_stack.mat');
proj = [];
if exist(projname, 'file')
check = inputwdefault('Absorption stack already exists - do you want to (re)-create it ? [y/n]', 'n');
if strcmpi(check,'n')
if strcmpi(check, 'n')
proj = load(projname);
else
proj = gtAstraPrepareAbsorptionStack(parameters);
......
......@@ -7,7 +7,6 @@ function abs = gtAstra_FBP2D(parameters, proj)
% Version 002 26-09-2012 by LNervo
% Formatting, cleaning, commenting
if ~exist('proj','var')
name = fullfile(parameters.acq.dir,'absorption_stack.mat');
if exist(name,'file')
......@@ -28,23 +27,21 @@ end
% now start FBP reconstruction of absorption volume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%proj_data=permute(proj.stack,[3 2 1]); % transforms stack of projection images to stack of sinograms
%proj_data = permute(proj.stack,[3 2 1]); % transforms stack of projection images to stack of sinograms
proj_data = proj.stack;
vsize=size(proj.stack,3); % numer of slices to be reconstructed
hsize=size(proj.stack,1); % number of pixels in projection image
nproj=size(proj.stack,2); % number of projections
hsize_zp=ceil(hsize*sqrt(2)); % zeropad projection images
offset=ceil((hsize_zp-hsize)/2);
sino=zeros(nproj,hsize_zp);
vsize = size(proj.stack, 3); % numer of slices to be reconstructed
hsize = size(proj.stack, 1); % number of pixels in projection image
nproj = size(proj.stack, 2); % number of projections
hsize_zp = ceil(hsize*sqrt(2)); % zeropad projection images
offset = ceil((hsize_zp-hsize)/2);
xvol=hsize;
yvol=hsize;
zvol=vsize;
sino = zeros(nproj,hsize_zp);
xvol = hsize;
yvol = hsize;
zvol = vsize;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% projection geometry (type, #rows, #columns, vectors)
......@@ -52,7 +49,7 @@ zvol=vsize;
proj_geom = astra_create_proj_geom('parallel', 1.0, hsize_zp, proj.Omega);
vol_geom = astra_create_vol_geom(hsize, hsize);
proj_id = astra_create_projector('linear', proj_geom, vol_geom);
sinogram_id = astra_mex_data2d('create','-sino', proj_geom, 0);
sinogram_id = astra_mex_data2d('create', '-sino', proj_geom, 0);
% allocate space to store reconstruction image
recon_id = astra_mex_data2d('create', '-vol', vol_geom, 0);
......@@ -66,26 +63,24 @@ cfg.ReconstructionDataId = recon_id;
cfg.FilterType = 'Ram-Lak';
cfg.option.GPUindex = 0;
abs = zeros(xvol, yvol, zvol);
abs=zeros(xvol,yvol,zvol);
for i=1:vsize
for ii = 1:vsize
alg_id = astra_mex_algorithm('create', cfg);
% 'zeropadding' projections with the value
sino=gtPlaceSubImage(squeeze(proj_data(:,:,i))',sino,offset,1);
sino = gtPlaceSubImage(squeeze(proj_data(:, :, ii))', sino, offset, 1);
sino(:,1:offset-1)=repmat(sino(:,offset),1,offset-1);
sino(:,offset+hsize:end)=repmat(sino(:,offset+hsize-1),1,hsize_zp-offset-hsize+1);
sino(:, 1:offset-1) = repmat(sino(:, offset), 1, offset-1);
sino(:, offset+hsize:end) = repmat(sino(:, offset+hsize-1), 1, hsize_zp-offset-hsize+1);
astra_mex_data2d('set',sinogram_id,sino)
astra_mex_data2d('set', sinogram_id, sino)
astra_mex_algorithm('run', alg_id);
% retrieve reconstruction from ASTRA lib
abs(:,:,vsize-i+1) = astra_mex_data2d('get', recon_id);
abs(:, :, vsize-ii+1) = astra_mex_data2d('get', recon_id);
astra_mex_algorithm('delete', alg_id);
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment