FanBeamGeometry.frommatrix

classmethod FanBeamGeometry.frommatrix(apart, dpart, src_radius, det_radius, init_matrix, det_curvature_radius=None, \*\*kwargs)[source]

Create an instance of FanBeamGeometry using a matrix.

This alternative constructor uses a matrix to rotate and translate the default configuration. It is most useful when the transformation to be applied is already given as a matrix.

Parameters
apart1-dim. RectPartition

Partition of the angle interval.

dpart1-dim. RectPartition

Partition of the detector parameter interval.

src_radiusnonnegative float

Radius of the source circle.

det_radiusnonnegative float

Radius of the detector circle. Must be nonzero if src_radius is zero.

init_matrixarray_like, shape (2, 2) or (2, 3), optional

Transformation matrix whose left (2, 2) block is multiplied with the default det_pos_init and det_axis_init to determine the new vectors. If present, the third column acts as a translation after the initial transformation. The resulting det_axis_init will be normalized.

det_curvature_radiusnonnegative float, optional

Radius of the detector curvature. If None, flat detector is used, otherwise must be positive.

kwargs :

Further keyword arguments passed to the class constructor.

Returns
geometryFanBeamGeometry

Examples

Mirror the second unit vector, creating a left-handed system:

>>> apart = odl.uniform_partition(0, np.pi, 10)
>>> dpart = odl.uniform_partition(-1, 1, 20)
>>> matrix = np.array([[1, 0],
...                    [0, -1]])
>>> geom = FanBeamGeometry.frommatrix(
...     apart, dpart, src_radius=1, det_radius=5, init_matrix=matrix)
>>> geom.det_refpoint(0)
array([ 0., -5.])
>>> geom.det_axis_init
array([ 1.,  0.])
>>> geom.translation
array([ 0.,  0.])

Adding a translation with a third matrix column:

>>> matrix = np.array([[1, 0, 1],
...                    [0, -1, 1]])
>>> geom = FanBeamGeometry.frommatrix(
...     apart, dpart, src_radius=1, det_radius=5, init_matrix=matrix)
>>> geom.translation
array([ 1.,  1.])
>>> geom.det_refpoint(0)  # (0, -5) + (1, 1)
array([ 1., -4.])