Parallel3dEulerGeometry.det_refpoint¶
- Parallel3dEulerGeometry.det_refpoint(angle)¶
Return the position(s) of the detector ref. point at
angle
.The reference point is given by a rotation of the initial position by
angle
.For an angle (or a vector of angles)
phi
, the detector position is given bydet_ref(phi) = translation + rotation_matrix(phi) * (det_pos_init - translation)
where
det_pos_init
is the detector reference point at initial state.This default implementation assumes in the case of 2 or 3 motion parameters that they are to be interpreted as Euler angles. Subclasses with a deviating intended interpretation should override this method.
- Parameters:
- angle
array-like
or sequence One or several (Euler) angles in radians at which to evaluate. If
motion_params.ndim >= 2
, a sequence of that length must be provided.
- angle
- Returns:
- refpt
numpy.ndarray
Vector(s) pointing from the origin to the detector reference point at
angle
. Ifangle
is a single parameter, the returned array has shape(ndim,)
, otherwiseangle.shape + (ndim,)
ifmotion_params
is 1D,broadcast(*angle).shape + (ndim,)
ifmotion_params
is 2D or 3D (Euler angles).
- refpt
See also
Examples
For 2d and default arguments, the detector starts at
e_y
and rotates to-e_x
at 90 degrees:>>> apart = odl.uniform_partition(0, np.pi, 10) >>> dpart = odl.uniform_partition(-1, 1, 20) >>> geom = Parallel2dGeometry(apart, dpart) >>> geom.det_refpoint(0) array([ 0., 1.]) >>> np.allclose(geom.det_refpoint(np.pi / 2), [-1, 0]) True
The method is vectorized, i.e., it can be called with multiple angles at once (or n-dimensional arrays of parameters):
>>> points = geom.det_refpoint([0, np.pi]) >>> np.allclose(points[0], [0, 1]) True >>> np.allclose(points[1], [0, -1]) True >>> geom.det_refpoint(np.zeros((4, 5))).shape (4, 5, 2)
In 3d with single rotation axis
e_z
, we have the same situation, except that the vectors have a third component equal to 0:>>> apart = odl.uniform_partition(0, np.pi, 10) >>> dpart = odl.uniform_partition([-1, -1], [1, 1], (20, 20)) >>> geom = Parallel3dAxisGeometry(apart, dpart) >>> geom.det_refpoint(0) array([ 0., 1., 0.]) >>> np.allclose(geom.det_refpoint(np.pi / 2), [-1, 0, 0]) True