diff options
author | Daniil Kazantsev <dkazanc@hotmail.com> | 2017-10-19 13:08:13 +0100 |
---|---|---|
committer | Daniil Kazantsev <dkazanc@hotmail.com> | 2017-10-19 13:08:13 +0100 |
commit | ff543b21e175d49b95ea6da9c03f21a1789f6833 (patch) | |
tree | 6467154575cac5ff68e05547b3ea54b94d814ebc /demos | |
parent | 1fa0357a98377618073cb46a67fc7c316172ac7b (diff) | |
download | regularization-ff543b21e175d49b95ea6da9c03f21a1789f6833.tar.gz regularization-ff543b21e175d49b95ea6da9c03f21a1789f6833.tar.bz2 regularization-ff543b21e175d49b95ea6da9c03f21a1789f6833.tar.xz regularization-ff543b21e175d49b95ea6da9c03f21a1789f6833.zip |
OS loop now fixed
Diffstat (limited to 'demos')
-rw-r--r-- | demos/Demo_Phantom3D_Cone.m | 4 | ||||
-rw-r--r-- | demos/Demo_Phantom3D_Parallel.m | 24 |
2 files changed, 22 insertions, 6 deletions
diff --git a/demos/Demo_Phantom3D_Cone.m b/demos/Demo_Phantom3D_Cone.m index 6419386..3a9178b 100644 --- a/demos/Demo_Phantom3D_Cone.m +++ b/demos/Demo_Phantom3D_Cone.m @@ -17,8 +17,8 @@ angles = 0:1.5:360; % angles vector in degrees angles_rad = angles*(pi/180); % conversion to radians det_size = round(sqrt(2)*N); % detector size % in order to run functions you have to go to the directory: -cd /home/algol/Documents/MATLAB/TomoPhantom/functions/ -TomoPhantom = buildPhantom3D(modelNo,N); % generate 3D phantom +pathTP = '/home/algol/Documents/MATLAB/TomoPhantom/functions/models/Phantom3DLibrary.dat'; % path to TomoPhantom parameters file +TomoPhantom = buildPhantom3D(modelNo,N,pathTP); % generate 3D phantom %% % using ASTRA-toolbox to set the projection geometry (cone beam) % eg: astra.create_proj_geom('cone', 1.0 (resol), 1.0 (resol), detectorRowCount, detectorColCount, angles, originToSource, originToDetector) diff --git a/demos/Demo_Phantom3D_Parallel.m b/demos/Demo_Phantom3D_Parallel.m index ac9827c..6a54450 100644 --- a/demos/Demo_Phantom3D_Parallel.m +++ b/demos/Demo_Phantom3D_Parallel.m @@ -10,19 +10,35 @@ addpath('../supp/'); %%
% build 3D phantom using TomoPhantom and generate projection data
-modelNo = 3; % see Phantom3DLibrary.dat file in TomoPhantom
+modelNo = 2; % see Phantom3DLibrary.dat file in TomoPhantom
N = 256; % x-y-z size (cubic image)
angles = 1:0.5:180; % angles vector in degrees
angles_rad = angles*(pi/180); % conversion to radians
det_size = round(sqrt(2)*N); % detector size
% in order to run functions you have to go to the directory:
-cd /home/algol/Documents/MATLAB/TomoPhantom/functions/
-TomoPhantom = buildPhantom3D(modelNo,N); % generate 3D phantom
-sino_tomophan3D = buildSino3D(modelNo, N, det_size, single(angles)); % generate data
+pathTP = '/home/algol/Documents/MATLAB/TomoPhantom/functions/models/Phantom3DLibrary.dat'; % path to TomoPhantom parameters file
+TomoPhantom = buildPhantom3D(modelNo,N,pathTP); % generate 3D phantom
+sino_tomophan3D = buildSino3D(modelNo, N, det_size, single(angles),pathTP); % generate ideal data
+% Adding noise and distortions if required
+sino_artifacts = sino_add_artifacts(sino_tomophan3D,'rings');
+%
%%
% using ASTRA-toolbox to set the projection geometry (parallel beam)
proj_geom = astra_create_proj_geom('parallel', 1, det_size, angles_rad);
vol_geom = astra_create_vol_geom(N,N);
+%%
+fprintf('%s\n', 'Reconstructing with FBP using ASTRA-toolbox ...');
+for i = 1:k
+vol_id = astra_mex_data2d('create', '-vol', vol_geom, 0);
+proj_id = astra_mex_data2d('create', '-proj3d', proj_geom, sino_artifacts(:,:,k));
+cfg = astra_struct('FBP_CUDA');
+cfg.ProjectionDataId = proj_id;
+cfg.ReconstructionDataId = vol_id;
+cfg.option.MinConstraint = 0;
+alg_id = astra_mex_algorithm('create', cfg);
+astra_mex_algorithm('iterate', alg_id, 15);
+reconASTRA_3D = astra_mex_data2d('get', vol_id);
+end
%%
fprintf('%s\n', 'Reconstruction using FISTA-LS without regularization...');
clear params
|