-
Notifications
You must be signed in to change notification settings - Fork 1
/
cross_section_sphere_thin.m
36 lines (26 loc) · 1.04 KB
/
cross_section_sphere_thin.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
function I = cross_section_sphere_thin(x_centre, y_centre, radius, psf_sigma, height, X)
% CROSS_SECTION_SPHERE_THIN - Return radial intensities of image of a thin spherical shell
%
% Input:
% x_centre - x coordinate of shell centre.
% y_centre - y coordinate of shell centre.
% radius - Shell radius.
% psf_sigma - Standard deviation of Gaussian point spread function.
% height - Height of image intensity.
% X - Array of (x, y) coordinates.
%
% Output:
% I - Vector of radial image intensities.
% Radial position
r = sqrt((X(:, 1) - x_centre).^2 + (X(:, 2) - y_centre).^2);
psf_variance = psf_sigma^2;
% Catch an issue when psf_variance goes to Inf
if psf_variance == Inf
psf_variance = 2^32;
end
I = height * (exp(-(r - radius).^2 / (2 * psf_variance)) - exp(-(r + radius).^2 / (2 * psf_variance))) ./ r;
% For r = 0, a singular point, use the limiting case
I(r == 0) = (2 * radius * height / psf_variance) * exp(-(radius^2) / (2 * psf_variance));
% assignin('base','PSF', psf_variance);
% assignin('base','II', I);
end