-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindGoodStepSizes_PC.m
More file actions
48 lines (36 loc) · 1.35 KB
/
Copy pathfindGoodStepSizes_PC.m
File metadata and controls
48 lines (36 loc) · 1.35 KB
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
function [optimalSigma, optimalTau] = findGoodStepSizes_PC(minSigma,...
maxSigma, nrmK, sinogram, nDetectors, detSize, thetas, translations, ...
nCols, nRows, pixSize, varargin )
defaultLevel=0;
p = inputParser;
p.addOptional( 'level', defaultLevel );
p.parse( varargin{:} );
level = p.Results.level;
levelThresh = 3;
nSteps = 10;
sigmas = logspace(log10(minSigma),log10(maxSigma),nSteps);
nSigmas = numel(sigmas);
mincosts = 9999 * ones(nSigmas,1);
disp(['Working on level ', num2str(level)]);
for i = 1:nSigmas
disp(['findGoodStepSizes: Working on ', num2str(i), ...
' of ', num2str(nSigmas)]);
thisSigma = sigmas(i);
thisTau = 1 / ( nrmK*nrmK*thisSigma ) * 0.999;
[~, costs] = ctCorrectForTranslation_PC( sinogram, nDetectors, ...
detSize, thetas, translations, nCols, nRows, pixSize, ...
thisSigma, thisTau );
mincosts(i) = min( costs(:) );
end
[~, minIndx] = min(mincosts);
optimalSigma = sigmas( minIndx );
optimalTau = 1 / ( nrmK*nrmK*optimalSigma ) * 0.999;
level = level+1;
if level <= levelThresh
minSigma = sigmas(max(minIndx-1,1));
maxSigma = sigmas(min(minIndx+1,nSteps));
[optimalSigma, optimalTau] = findGoodStepSizes_PC( minSigma,...
maxSigma, nrmK, sinogram, nDetectors, detSize, thetas, ...
translations, nCols, nRows, pixSize, level );
end
end