ConeBeamGeometry.frommatrix

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

Create an instance of ConeBeamGeometry 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 parameter interval.

dpart2-dim. RectPartition

Partition of the detector parameter set.

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 (3, 3) or (3, 4), optional

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

det_curvature_radius2-tuple of nonnegative floats, optional

Radius or radii of the detector curvature. If None, a flat detector is used. If (r, None) or (r, float('inf')), a cylindrical detector is used. If (r1, r2), a spherical detector is used.

pitchfloat, optional

Constant distance along the rotation axis that a point on the helix traverses when increasing the angle parameter by 2 * pi. The default case pitch=0 results in a circular cone beam geometry.

kwargs :

Further keyword arguments passed to the class constructor.

Returns
geometryConeBeamGeometry

Examples

Map unit vectors e_y -> e_z and e_z -> -e_y, keeping the right-handedness:

>>> apart = odl.uniform_partition(0, 2 * np.pi, 10)
>>> dpart = odl.uniform_partition([-1, -1], [1, 1], (20, 20))
>>> matrix = np.array([[1, 0, 0],
...                    [0, 0, -1],
...                    [0, 1, 0]])
>>> geom = ConeBeamGeometry.frommatrix(
...     apart, dpart, src_radius=5, det_radius=10, pitch=2,
...     init_matrix=matrix)
>>> geom.axis
array([ 0., -1.,  0.])
>>> geom.src_to_det_init
array([ 0.,  0.,  1.])
>>> geom.det_axes_init
array([[ 1.,  0.,  0.],
       [ 0., -1.,  0.]])

Adding a translation with a fourth matrix column:

>>> matrix = np.array([[0, 0, -1, 0],
...                    [0, 1, 0, 1],
...                    [1, 0, 0, 1]])
>>> geom = ConeBeamGeometry.frommatrix(
...     apart, dpart, src_radius=5, det_radius=10, pitch=2,
...     init_matrix=matrix)
>>> geom.translation
array([ 0.,  1.,  1.])
>>> geom.det_refpoint(0)  # (0, 10, 0) + (0, 1, 1)
array([  0.,  11.,   1.])