Parallel2dGeometry

class odl.tomo.geometry.parallel.Parallel2dGeometry(apart, dpart, det_pos_init=(0, 1), **kwargs)[source]

Bases: ParallelBeamGeometry

Parallel beam geometry in 2d.

The motion parameter is the counter-clockwise rotation angle around the origin, and the detector is a line detector.

In the standard configuration, the detector is perpendicular to the ray direction, its reference point is initially at (0, 1), and the initial detector axis is (1, 0).

For details, check the online docs.

Attributes:
angles

All angles of this geometry as an array.

check_bounds

If True, methods computing vectors check input arguments.

det_axis_init

Detector axis at angle 0.

det_grid

Sampling grid of det_params.

det_params

Continuous detector parameter range, an IntervalProd.

det_partition

Partition of the detector parameter set into subsets.

det_pos_init

Initial position of the detector reference point.

detector

Detector representation of this geometry.

grid

Joined sampling grid for motion and detector.

implementation_cache

Dictionary acting as a cache for this geometry.

motion_grid

Sampling grid of motion_params.

motion_params

Continuous motion parameter range, an IntervalProd.

motion_partition

Partition of the motion parameter set into subsets.

ndim

Number of dimensions of the geometry.

params

Joined parameter set for motion and detector.

partition

Joined parameter set partition for motion and detector.

translation

Shift of the origin of this geometry.

Methods

det_axis(angle)

Return the detector axis (axes) at angle.

det_point_position(mparam, dparam)

Return the detector point at (mparam, dparam).

det_refpoint(angle)

Return the position(s) of the detector ref.

det_to_src(angle, dparam)

Direction from a detector location to the source.

frommatrix(apart, dpart, init_matrix, **kwargs)

Create an instance of Parallel2dGeometry using a matrix.

rotation_matrix(angle)

Return the rotation matrix to the system state at angle.

__init__(apart, dpart, det_pos_init=(0, 1), **kwargs)[source]

Initialize a new instance.

Parameters:
apart1-dim. RectPartition

Partition of the angle interval.

dpart1-dim. RectPartition

Partition of the detector parameter interval.

det_pos_initarray-like, shape (2,), optional

Initial position of the detector reference point.

Other Parameters:
det_axis_initarray-like (shape (2,)), optional

Initial axis defining the detector orientation. The default depends on det_pos_init, see Notes.

translationarray-like, shape (2,), optional

Global translation of the geometry. This is added last in any method that computes an absolute vector, e.g., det_refpoint, and also shifts the center of rotation. Default: (0, 0)

check_boundsbool, optional

If True, methods computing vectors check input arguments. Checks are vectorized and add only a small overhead. Default: True

Notes

In the default configuration, the initial detector reference point is (0, 1), and the initial detector axis is (1, 0). If a different det_pos_init is chosen, the new default axis is given as a rotation of the original one by a matrix that transforms (0, 1) to the new (normalized) det_pos_init. This matrix is calculated with the rotation_matrix_from_to function. Expressed in code, we have

init_rot = rotation_matrix_from_to((0, 1), det_pos_init)
det_axis_init = init_rot.dot((1, 0))

If det_pos_init == (0, 0), no rotation is performed.

Examples

Initialization with default parameters:

>>> apart = odl.uniform_partition(0, np.pi, 10)
>>> dpart = odl.uniform_partition(-1, 1, 20)
>>> geom = Parallel2dGeometry(apart, dpart)
>>> np.allclose(geom.det_refpoint(0), (0, 1))
True
>>> np.allclose(geom.det_point_position(0, 1), (1, 1))
True

Checking the default orientation:

>>> e_x, e_y = np.eye(2)  # standard unit vectors
>>> np.allclose(geom.det_pos_init, e_y)
True
>>> np.allclose(geom.det_axis_init, e_x)
True

Specifying an initial detector position by default rotates the standard configuration to this position:

>>> geom = Parallel2dGeometry(apart, dpart, det_pos_init=(-1, 0))
>>> np.allclose(geom.det_pos_init, -e_x)
True
>>> np.allclose(geom.det_axis_init, e_y)
True
>>> geom = Parallel2dGeometry(apart, dpart, det_pos_init=(0, -1))
>>> np.allclose(geom.det_pos_init, -e_y)
True
>>> np.allclose(geom.det_axis_init, -e_x)
True

The initial detector axis can also be set explicitly:

>>> geom = Parallel2dGeometry(
...     apart, dpart, det_pos_init=(0, -1), det_axis_init=(1, 0))
>>> np.allclose(geom.det_pos_init, -e_y)
True
>>> np.allclose(geom.det_axis_init, e_x)
True