labs.datasets.transforms.affine_utils

Module: labs.datasets.transforms.affine_utils

Functions working with affine transformation matrices.

Functions

nipy.labs.datasets.transforms.affine_utils.apply_affine(x, y, z, affine)

Apply the affine matrix to the given coordinate.

Parameters
x: number or ndarray

The x coordinates

y: number or ndarray

The y coordinates

z: number or ndarray

The z coordinates

affine: 4x4 ndarray

The affine matrix of the transformation

nipy.labs.datasets.transforms.affine_utils.from_matrix_vector(matrix, vector)

Combine a matrix and vector into a homogeneous transform.

Combine a rotation matrix and translation vector into a transform in homogeneous coordinates.

Parameters
matrixndarray

An NxN array representing the rotation matrix.

vectorndarray

A 1xN array representing the translation.

Returns
xformndarray

An N+1xN+1 transform matrix.

See also

to_matrix_vector
nipy.labs.datasets.transforms.affine_utils.get_bounds(shape, affine)

Return the world-space bounds occupied by an array given an affine.

nipy.labs.datasets.transforms.affine_utils.to_matrix_vector(transform)

Split a transform into it’s matrix and vector components.

The tranformation must be represented in homogeneous coordinates and is split into it’s rotation matrix and translation vector components.

Parameters
transformndarray

Transform matrix in homogeneous coordinates. Example, a 4x4 transform representing rotations and translations in 3 dimensions.

Returns
matrix, vectorndarray

The matrix and vector components of the transform matrix. For an NxN transform, matrix will be N-1xN-1 and vector will be 1xN-1.