Main Content

fanbeam

Fan-beam transform

Description

example

F= fanbeam(I,D)calculates the fan-beam projection data (sinogram)Ffrom the imageI. Each column ofFcontains fan-beam projection data at one rotation angle.Dis the distance from the fan-beam vertex to the center of rotation.

F= fanbeam(I,D,Name,Value)uses name-value arguments to specify the rotation increment and sensor spacing.

example

[F,fanSensorPos,fanRotAngles] = fanbeam(___)also returns the location of fan-beam sensors infanSensorPosand the rotation angles where the fan-beam projections are calculated infanRotAngles.

Examples

collapse all

Set the IPT preference to make the axes visible.

iptsetpref('ImshowAxesVisible','on')

Create a sample image and display it.

ph = phantom(128); imshow(ph)

Figure contains an axes object. The axes object contains an object of type image.

Calculate the fanbeam projections and display them.

[F,Fpos,Fangles] = fanbeam(ph,250); figure imshow(F,[],“XData”,Fangles,'YData',Fpos,...'InitialMagnification','fit') axisnormalxlabel('Rotation Angles (degrees)') ylabel('Sensor Positions (degrees)') colormap(gca,hot), colorbar

Figure contains an axes object. The axes object contains an object of type image.

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.

[R,Rpos]=radon(I,Fangles);

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')

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent Radon, Arc, Line.

Input Arguments

collapse all

Input image, specified as a 2-D numeric matrix or 2-D logical matrix.

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 asfloor((size(I)+1)/2).Dmust be large enough to ensure that the fan-beam vertex is outside of the image at all rotation angles. SeeTipsfor guidelines on specifyingD.

Fan-beam image geometry highlighting the distance D between the fan-beam vertex and the center of rotation

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example:fanbeam(I,D,FanRotationIncrement=5)

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

Example:fanbeam(I,D,"FanRotationIncrement",5)

Fan-beam rotation angle increment in degrees, specified as a positive scalar.

Fan-beam image geometry highlighting the angular separation of two successive fan-beam vertices by FanRotationIncrement degrees.

Data Types:double

Fan-beam sensor positioning, specified as"arc"or"line".

Value

Meaning

Diagram

"arc"

Sensors are spaced at equal angles along a circular arc. The center of the arc is the fan-beam vertex.

FanSensorSpacingdefines the angular spacing in degrees.

Fan-beam image geometry highlighting the constant angular spacing between sensors in an arc

"line"

Sensors are spaced at equal distances along a line that is parallel to thex'axis. The closest sensor is distanceDfrom the center of rotation.

FanSensorSpacingdefines the distance between fan-beams on thex'axis, in pixels.

Fan-beam image geometry highlighting the constant distance between sensors in a line

Fan-bean sensor spacing, specified as a positive scalar.

  • IfFanSensorGeometryis"arc", thenFanSensorSpacingdefines the angular spacing in degrees.

  • IfFanSensorGeometryis"line", thenFanSensorSpacingdefines the linear distance between fan-beams, in pixels. Linear spacing is measured on thex'axis.

Data Types:double

Output Arguments

collapse all

Fan-beam projection data, returned as anumSensors-by-numAnglesnumeric matrix.numSensorsis the number of fan-beam sensors andnumAnglesis the number of fan-beam rotation angles. Each column ofFcontains the fan-beam sensor samples at one rotation angle.

fanbeamdeterminesnumAnglesby calculating how many rotation angles are required to span 360 degrees using an angular spacing ofFanRotationIncrement.

fanbeamdeterminesnumSensorsby calculating how many beams are required to cover the entire image for any rotation angle. Fewer sensors are required to cover the image when the distanceDbetween the fan-beam vertex and the center of rotation is large.

Data Types:double

Location of fan-beam sensors, returned as anumSensors-by-1 numeric vector.

  • IfFanSensorGeometryis"arc"(the default), thenfanSensorPoscontains the fan-beam spread angles.

  • IfFanSensorGeometryis"line", thenfanSensorPoscontains the fan-beam sensor positions along thex'axis. SeeFanSensorSpacingfor more information.

Data Types:double

Rotation angle of fan-beam sensors, returned as a 1-by-numAnglesnumeric vector.

Data Types:double

Tips

As a guideline, try makingDa few pixels larger than half the image diagonal dimension, calculated as follows.

sqrt(size(I,1)^2 + size(I,2)^2)

The values returned inFare 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 larger,Dis larger, and for points closer to the middle of the image, away from the edges.

References

[1]Kak, Avinash C., and Malcolm Slaney.Principles of Computerized Tomographic Imaging. New York: IEEE Press, 1988.. pp. 92-93.

Version History

Introduced before R2006a