-
Notifications
You must be signed in to change notification settings - Fork 9
/
startupCT.m
74 lines (56 loc) · 2.69 KB
/
startupCT.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
clear; clc; close all;
fprintf('Welcome to the X-ray CT simluation toolbox!\n')
fprintf('\tcopyright: Meng Wu at Stanford University (2012-2014)\n');
fprintf('\tcontact: [email protected]\n');
%% add path
fprintf('\tAdding needed paths... ');
addpath(genpath('../CTSim'));
addpath(genpath('../CTData'));
%addpath(genpath('../Tools'));
fprintf('\tdone.\n');
fprintf('\tAdding output paths... ');
outputDir = [ 'output'] ;
if outputDir(end) ~= '/', outputDir = [outputDir '/']; end % make sure directory ends with a slash
if ~exist(outputDir, 'dir'), mkdir(outputDir); end % make sure output directory exists
addpath(genpath(outputDir));
fprintf('\tdone.\n');
%% Reduce dimension and downsampling
downsampleRate = 1;
dimemsions = 3;
parameters = 'parametersTabletop.ini';
% parameters = 'parametersTrueBeamTomo.ini';
% parameters = 'parametersBeamHardening.ini';
% parameters = 'parametersSiemensZeego.ini';
% parameters = 'parametersGElightspeed.ini';
% parameters = 'parametersVarianCBCT.ini';
% parameters = 'parametersSOMATOM.ini';
fprintf('\tRead Parameter File... ');
p = readParametersCT(parameters);
%downsampling
if downsampleRate ~= 1
p.Reconstruction.size = round( p.Reconstruction.size / downsampleRate );
p.Reconstruction.spacing = p.Reconstruction.spacing * downsampleRate;
p.Geometries.sizeDet = round( p.Geometries.sizeDet / downsampleRate );
p.Geometries.noViews = round( p.Geometries.noViews / downsampleRate );
p.Geometries.spacingDet = p.Geometries.spacingDet * downsampleRate;
end
%reduce dimension
if dimemsions == 2
p.Reconstruction.size = p.Reconstruction.size(1:2);
p.Reconstruction.spacing = p.Reconstruction.spacing(1:2);
p.Reconstruction.offset = p.Reconstruction.offset(1:2);
p.Geometries.sizeDet = p.Geometries.sizeDet(1);
p.Geometries.spacingDet = p.Geometries.spacingDet(1);
p.Geometries.offsetDet = p.Geometries.offsetDet(1);
sinosDir = sprintf('../CTData/SinogramDataCT/sinoData-%s-%s-%imm-%imm-%ix%i-%ium/', ...
parameters(11:end-4), p.Phantom.materialsFileName, p.Geometries.SAD, p.Geometries.ADD,...
p.Geometries.noViews, p.Geometries.sizeDet(1), round(p.Geometries.spacingDet(1)*1000));
else
p.Phantom.materialsFileName = [p.Phantom.materialsFileName '-3d'];
sinosDir = sprintf('../CTData/SinogramDataCT/sinoData-%s-%s-%imm-%imm-%ix%ix%i-%ium/', ...
parameters(11:end-4), p.Phantom.materialsFileName, p.Geometries.SAD, p.Geometries.ADD,...
p.Geometries.noViews, p.Geometries.sizeDet(1),p.Geometries.sizeDet(2), ...
round(p.Geometries.spacingDet(1)*1000));
end
save('temp.mat', 'p', 'outputDir', 'sinosDir');
fprintf('\tdone.\n\n\n');