-
Notifications
You must be signed in to change notification settings - Fork 0
/
psf2D1.m
39 lines (30 loc) · 1.24 KB
/
psf2D1.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
function M = psf2D1(pixSize,NA,lambda)
%PSF2D generates a 2D point spread function model (Airy disc)
%
% SYNOPSIS M = psf2D(pixSize,NA,lambda)
%
% INPUT pixSize : pixel size in object space (in um)
% NA : numerical aperture of the objective lens
% lambda : wavelength of light (in um)
%
% OUTPUT M : filter mask (odd dimensions) representing the Airy disk
% the filter is normalized to sum(M(:)) = 1
%
% NOTE the function calculates the Airy disk radius according to
% R0 = 0.61 * lambda / NA
%
% REMARK - M is not normalized here!
%
% Alexandre Matov, January 7th, 2003
R0 = 0.61 * lambda / NA;
R1 = 7.02 / 3.83 * R0; % position of the second root of the Bessel function
% dim = 2*ceil(R1/pixSize)+1;
[x,y] = meshgrid(-ceil(R1/pixSize):ceil(R1/pixSize));
d = sqrt(x.^2+y.^2)+ 0.01 ; % shift center by a 1/100 pixel to avoid division-by-0
% in the next step
ds = d*pixSize/R0*3.83;
psfs = (besselj(1,ds)./ds);
psf = psfs.*conj(psfs);
% normalization to sum(M(:))=1;
%M = psf / sum(psf(:));
M=psf/max(psf(:));