FanBeamGeometry.src_position

FanBeamGeometry.src_position(self, angle)[source]

Return the source position at angle.

For an angle phi, the source position is given by

src(phi) = translation +
           rot_matrix(phi) * (-src_rad * src_to_det_init) +
           source_shift(phi)

where src_to_det_init is the initial unit vector pointing from source to detector and

source_shift(phi) = rot_matrix(phi) *

(shift[0] * (-src_to_det_init) + shift[1] * tangent)

where tangent is a vector tangent to the trajectory

where src_to_det_init is the initial unit vector pointing from source to detector.

Parameters
anglefloat or array-like

Angle(s) in radians describing the counter-clockwise rotation of source and detector.

Returns
posnumpy.ndarray

Vector(s) pointing from the origin to the source. If angle is a single parameter, the returned array has shape (2,), otherwise angle.shape + (2,).

See also

det_refpoint

Examples

With default arguments, the source starts at src_rad * (-e_y) and rotates to src_rad * e_x at 90 degrees:

>>> apart = odl.uniform_partition(0, 2 * np.pi, 10)
>>> dpart = odl.uniform_partition(-1, 1, 20)
>>> geom = FanBeamGeometry(apart, dpart, src_radius=2, det_radius=5)
>>> geom.src_position(0)
array([ 0., -2.])
>>> np.allclose(geom.src_position(np.pi / 2), [2, 0])
True

The method is vectorized, i.e., it can be called with multiple angles at once:

>>> points = geom.src_position([0, np.pi / 2])
>>> np.allclose(points[0], [0, -2])
True
>>> np.allclose(points[1], [2, 0])
True

Specifying flying focal spot:

>>> apart = odl.uniform_partition(0, 2 * np.pi, 4)
>>> geom = FanBeamGeometry(
...     apart, dpart,
...     src_radius=1, det_radius=5,
...     src_shift_func=lambda angle: odl.tomo.flying_focal_spot(
...         angle,
...         apart=apart,
...         shifts=[(0.1, 0), (0, 0.1)]),
...     src_to_det_init=(-0.71, 0.71))
>>> geom.angles
array([ 0.78539816,  2.35619449,  3.92699082,  5.49778714])
>>> np.round(geom.src_position(geom.angles), 2)
array([[ 1.1, -0. ],
       [-0.1,  1. ],
       [-1.1,  0. ],
       [ 0.1, -1. ]])