transform_system

odl.tomo.util.utility.transform_system(principal_vec, principal_default, other_vecs, matrix=None)[source]

Transform vectors with either matrix or based on principal_vec.

The logic of this function is as follows:

  • If matrix is not None, transform principal_vec and all vectors in other_vecs by matrix, ignoring principal_default.

  • If matrix is None, compute the rotation matrix from principal_default to principal_vec, not including the dilation. Apply that rotation to all vectors in other_vecs.

Note: All vectors must have the same shape and match the shape of matrix if given.

Parameters:
principal_vecarray-like, shape (ndim,)

Vector that defines the transformation if matrix is not provided.

principal_defaultarray-like, shape (ndim,)

Default value for principal_vec. The deviation from this determines the transformation. If matrix is given, this has no effect.

other_vecssequence of None or array-like's with shape (ndim,)

The other vectors that should be transformed. None entries are just appended as-is.

matrixarray-like, shape (ndim, ndim), optional

Explicit transformation matrix to be applied to the vectors. It is allowed to include a constant scaling but shouldn't have strongly varying directional scaling (bad condition).

Returns:
transformed_vecstuple of numpy.ndarray, shape (ndim,)

The transformed vectors. The first entry is (the transformed) principal_vec, followed by the transformed other_vecs. Thus the length of the tuple is len(other_vecs) + 1.