-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevalSigma.m
66 lines (52 loc) · 1.52 KB
/
evalSigma.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
function sigma_ga=evalSigma(sigma_ga,height)
% evalSigma fits Bessel PSF with a GK
% (sigma_ga,height) = (1,1) default
% the height is fixed, for sigma_ga we give the initial value
%
% SYNOPSIS sigma_ga=evalSigma(sigma_ga,height)
%
%
% INPUT sigma_ga : sigma of the GK
% height : height of the GK
%
% OUTPUT sigma_ga : sigma after fitting
%
% DEPENDENCES evalSigma uses { psf2D1, bessToGauss,
% lsqnonlin, gauss2Djac }
% evalSigma is used by { }
%
% Alexandre Matov, January 7th, 2003
options = optimset('Jacobian','on','Display','on');
if nargin == 0
sigma_ga=1;
height=1;
end
lb=0;
ub=10;
% SYNOPSIS PSF = psf2D(pixSize,NA,lambda)
hB=psf2D1(0.067,1.4,0.595);
sZ=size(hB,1);
cT=((sZ-1)/2)+1;
R=(sZ-1)/2;% Radius for the GK
sigma_ga=lsqnonlin(@bessToGauss,sigma_ga,lb,ub,options,hB,height);
[jac,hG]=gauss2Djac(sigma_ga,R,height);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEBUG
MaxValueCenterDataPSF=max(hB(:))
MaxValueCenterModelGK=max(hG(:))
HEIGHT_FIXED=height
SIGMA_PARAMETER=sigma_ga
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Figures
figure(1)
surf(hB);
title('PSF (pixSize,NA,lambda) = (0.067,1.4,0.595)');
axis([0 25 0 25 0 1.5]);
figure(2)
surf(hG);
title('fitting GK -> gauss2D11(sigma,height)');
axis([0 25 0 25 0 1.5]);
figure(3);
surf(hB-hG);
title('substruction PSF-GK; after optimization h - fixed; sigma - found using Matlab function LSQNONLIN');
axis([0 25 0 25 0 1.5]);