para2fan
Convert parallelbeam projections to fanbeam
Syntax
Description
converts the parallelbeam data F
= para2fan(P
,D
)P
to the fanbeam data
F
. Each column of P
contains the parallelbeam
sensor samples at one rotation angle. D
is the distance from the fanbeam
vertex to the center of rotation.
The parallelbeam sensors are assumed to have a onepixel spacing. The parallelbeam rotation angles are spaced equally to cover [0,180] degrees. The calculated fanbeam rotation angles have the same spacing as the parallelbeam rotation angles, and cover [0,360) degrees. The calculated fanbeam angles are equally spaced with the spacing set to the smallest angle implied by the sensor spacing.
uses namevalue pairs to control aspects of the data conversion.F
= fan2para(P
,D
,Name,Value
)
[
returns the fanbeam sensor locations in F
,fan_sensor_positions
,fan_rotation_angles
]
= fan2para(___)fan_sensor_positions
and
rotation angles in fan_rotation_angles
.
Examples
Convert Parallelbeam Projections to Fanbeam Projections
Generate parallelbeam projections
ph = phantom(128); theta = 0:180; [P,xp] = radon(ph,theta); imshow(P,[],'XData',theta,'YData',xp,'InitialMagnification','fit') axis normal title('ParallelBeam Projections') xlabel('\theta (degrees)') ylabel('x''') colormap(gca,hot), colorbar
Convert to fanbeam projections
[F,Fpos,Fangles] = para2fan(P,100); figure imshow(F,[],'XData',Fangles,'YData',Fpos,'InitialMagnification','fit') axis normal title('FanBeam Projections') xlabel('\theta (degrees)') ylabel('Sensor Locations (degrees)') colormap(gca,hot), colorbar
Input Arguments
P
— Parallelbeam projection data
numeric matrix
Parallelbeam projection data, specified as a numeric matrix. Each column of
P
contains the parallelbeam data at one rotation angle. The number
of columns indicates the number of parallelbeam rotation angles and the number of rows
indicates the number of parallelbeam sensors.
Data Types: double
 single
D
— Distance from fan beam vertex to center of rotation
positive number
Distance in pixels from the fan beam vertex to the center of rotation, specified as
a positive number. para2fan
assumes that the center of rotation is
the center point of the projections, which is defined as
ceil(size(F,1)/2)
. The value of D
must be
greater than or equal to ParallelSensorSpacing
*(SIZE(P,1)1)/2
The figure illustrates D
in relation to the fanbeam vertex for
one fanbeam projection.
Data Types: double
 single
NameValue Arguments
Specify optional
commaseparated pairs of Name,Value
arguments. Name
is
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
Name1,Value1,...,NameN,ValueN
.
F = para2fan(P,D,'FanRotationIncrement',5)
FanCoverage
— Range of fanbeam rotation
'cycle'
(default)  'minimal'
Range of fanbeam rotation, specified as the commaseparated pair consisting of
'FanCoverage'
and one of these values.
'cycle'
— Rotate through the full range [0, 360) degrees.'minimal'
— Rotate through the minimum range necessary to represent the object.
FanRotationIncrement
— Fanbeam rotation angle increment
positive scalar
Fanbeam rotation angle increment in degrees, specified as the commaseparated
pair consisting of 'FanRotationIncrement'
and a positive scalar.
If
FanCoverage
is'cycle'
, then360/
FanRotationIncrement
must be an integer.If you do not specify
FanRotationIncrement
, then the default value is equal to the parallelbeam rotation angle.
Data Types: double
FanSensorGeometry
— Fanbeam sensor positioning
'arc'
(default)  'line'
Fanbeam sensor positioning, specified as the commaseparated pair consisting of
'FanSensorGeometry'
and one of the following
values.
Value  Meaning  Diagram 

 Sensors are spaced at equal angles along a circular arc at
distance
 
 Sensors are spaced at equal distances along a line that is
parallel to the x' axis. The closest sensor
is distance

FanSensorSpacing
— Fanbeam sensor spacing
positive scalar
Fanbeam sensor spacing, specified as the commaseparated pair consisting of
'FanSensorSpacing'
and a positive scalar.
If
FanSensorGeometry
is'arc'
, thenFanSensorSpacing
defines the angular spacing in degrees.If
FanSensorGeometry
is'line'
, thenFanSensorSpacing
defines the linear distance between fanbeams, in pixels. Linear spacing is measured on the x' axis.
If you do not specify FanSensorGeometry
, then the default
value of FanSensorSpacing
is the smallest value implied by
ParallelSensorSpacing
such that:
If
FanSensorGeometry
is'arc'
, thenFanSensorSpacing
is180/pi*ASIN(
ParallelSensorSpacing
/D
)If
FanSensorGeometry
is'line'
, thenFanSensorSpacing
isD
*ASIN(ParallelSensorSpacing
/D
)
Data Types: double
Interpolation
— Type of interpolation
'Linear'
(default)  'nearest'
 'spline'
 'pchip'
Type of interpolation used between the parallelbeam and fanbeam data, specified
as the commaseparated pair consisting of 'Interpolation'
and one
of these values.
'nearest'
— Nearestneighbor
'linear'
— Linear (the default)
'spline'
— Piecewise cubic spline
'pchip'
— Piecewise cubic Hermite (PCHIP)
ParallelCoverage
— Range of parallelbeam rotation
'halfcycle'
(default)  'cycle
Range of parallelbeam rotation, specified as the commaseparated pair consisting
of 'ParallelCoverage'
and one of these values.
'cycle'
— Parallel data covers the full range of [0, 360) degrees.'halfcycle'
— Parallel data covers [0, 180) degrees.
ParallelSensorSpacing
— Parallelbeam sensor spacing
1
 positive scalar
Parallelbeam sensor spacing in pixels, specified as the commaseparated pair
consisting of 'ParallelSensorSpacing'
and a positive scalar.
Data Types: double
Output Arguments
F
— Fanbeam projection data
numeric matrix
Fanbeam projection data, returned as a numeric matrix. Each column of
F
contains the fanbeam sensor samples at one rotation
angle.
Parallelbeam projection data, returned as a numeric matrix. Each column of
F
contains the fanbeam data at one rotation angle. The number of
columns indicates the total number of fanbeam rotation angles and is equal to the
length of fan_rotation_angles
. The number of rows indicates the
total number of parallelbeam sensors and is equal to the length of
fan_sensor_positions
.
Data Types: double
fan_sensor_positions
— Fanbeam sensor locations
numeric column vector
Fanbeam sensor locations, returned as a numeric column vector.
If
'
isFanSensorGeometry
''arc'
(the default), thenfan_sensor_positions
contains the fanbeam sensor measurement angles.If
'
isFanSensorGeometry
''line'
, thenfan_sensor_positions
contains the fanbeam sensor positions along the line of sensors.
Data Types: double
fan_rotation_angles
— Fanbeam rotation angles
numeric row vector
Fanbeam rotation angles, returned as a numeric row vector.
Data Types: double
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)