-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLabScript.m
More file actions
76 lines (58 loc) · 1.61 KB
/
LabScript.m
File metadata and controls
76 lines (58 loc) · 1.61 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%%
%data simulation
datapars.nth=60;
datapars.ns=100;
datapars.ds=1.01;
datapars.soff=50.25;
smallph;
nsub=10;
soff=datapars.soff;
sino=zeros(datapars.nth,datapars.ns);
for k=1:nsub
shift=0.5-1/(2*nsub)-(k-1)/nsub;
datapars.soff=soff+shift;
sino=sino+sinogram(datapars,E,1);
end;
sino=sino/nsub;
datapars.soff=soff;
%with noise
noise=1; %INVESTIGATE noise=0 and noise=1
if noise
muw=0.0183;
Nin=6e4;
Nout=Nin*exp(-muw*sino);
sino=(muw*sino+randn(size(sino))./sqrt(Nout))/muw;
end
%%
%image reconstruction set-up
impars.nx=100;
impars.dx=1;
impars.xoff=50;
impars.ny=100;
impars.dy=1;
impars.yoff=50;
radius=48;
fovmask=phantom(impars,[0 0 radius radius 0 1]);
fovmask(1,:)=0;fovmask(end,:)=0;
fovmask(:,1)=0;fovmask(:,end)=0;
truth=phantom(impars,E);
figure(1),imagesc(truth,[0.85,1.15]),axis image,colormap gray
%%
%Lipschitz constant evaluation
niter=5;
[L] = Lipschitz(impars,datapars,niter,fovmask) %CREATE THIS FUNCTION
%%
%iterative reconstruction
lambda= 0.95*1/L; %ADJUST
niter= 100; %ADJUST
initim=zeros(impars.ny,impars.nx);
%reconstruction with quadratic penalty
regpars.pos=1; %1: with positivy constraint, else without
regpars.mode=0; %1: edge preserving, else quadratic INVESTIGATE BOTH OPTIONS
regpars.beta=2.0; %INVESTIGATE USING 0.0 and 2.0
regpars.delta=0.005;
%CREATE THE TWO FUNCTIONS BELOW AS ALTERNATIVE OPTIONS
%DISPLAY THE RESULT IN figure(1) AT EACH ITERATION WITHIN THE FUNCTION
figure(1),
%[rcn1] = GradDescent(impars,datapars,regpars,initim,sino,lambda,niter,fovmask);
[rcn2] = AccGradDescent(impars,datapars,regpars,initim,sino,lambda,niter,fovmask);