Set the IPT preference to make the axes visible.
Create a sample image and display it.
ph = phantom(128); imshow(ph)
Calculate the fanbeam projections and display them.
[F,Fpos,Fangles] = fanbeam(ph,250); figure imshow(F,,'XData',Fangles,'YData',Fpos,... 'InitialMagnification','fit') axis normal xlabel('Rotation Angles (degrees)') ylabel('Sensor Positions (degrees)') colormap(gca,hot), colorbar
Compute fan-beam projections for 'arc' geometry.
I = ones(100); D = 200; dtheta = 45; [Farc,FposArcDeg,Fangles] = fanbeam(I,D,... 'FanSensorGeometry','arc',... 'FanRotationIncrement',dtheta);
Convert angular positions to linear distance along x-prime axis.
FposArc = D*tan(FposArcDeg*pi/180);
Compute fan-beam projections for 'line' geometry.
[Fline,FposLine] = fanbeam(I,D,... 'FanSensorGeometry','line',... 'FanRotationIncrement',dtheta);
Compute the corresponding Radon transform.
Display the three projections at one particular rotation angle. Note the three are very similar. Differences are due to the geometry of the sampling, and the numerical approximations used in the calculations.
figure idx = find(Fangles==45); plot(Rpos,R(:,idx),... FposArc,Farc(:,idx),... FposLine,Fline(:,idx)) legend('Radon','Arc','Line')
I— Input image
Input image, specified as a 2-D numeric or logical matrix.
D— Distance from fan beam vertex to center of rotation
Distance in pixels from the fan beam vertex to the
center of rotation, specified as a positive number.
The center of rotation is the center pixel of the
image, defined as
D must be large enough to
ensure that the fan-beam vertex is outside of the
image at all rotation angles. See Tips for guidelines on specifying
D. The figure illustrates
D in relation to the fan-beam
vertex for one fan-beam geometry.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
F = fanbeam(I,D,'FanRotationIncrement',5)
F— Fan-beam projection data
Fan-beam projection data, returned as a
numeric matrix. numsensors is the
number of fan-beam sensors and
numangles is the number of
fan-beam rotation angles. Each column of
F contains the fan-beam sensor
samples at one rotation angle.
fan_sensor_positions— Location of fan-beam sensors
Location of fan-beam sensors, returned as a numsensors-by-1 numeric vector.
fanbeam determines the number of
sensors by calculating how many beams are required
to cover the entire image for any rotation angle.
Fewer sensors are required to cover the image when
D between the
fan-beam vertex and the center of rotation is
fan_rotation_angles— Rotation angle of fan-beam sensors
Rotation angle of fan-beam sensors, returned as a
1-by-numangles numeric vector.
As a guideline, try making
D a few pixels larger than
half the image diagonal dimension, calculated as follows.
sqrt(size(I,1)^2 + size(I,2)^2)
The values returned in
F are a numerical approximation of
the fan-beam projections. The algorithm depends on the Radon transform,
interpolated to the fan-beam geometry. The results vary depending on the
parameters used. You can expect more accurate results when the image is
D is larger, and for points closer to the middle
of the image, away from the edges.
 Kak, A.C., & Slaney, M., Principles of Computerized Tomographic Imaging, IEEE Press, NY, 1988, pp. 92-93.