Module: labs.datasets.transforms.affine_utils

Functions working with affine transformation matrices.


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

Apply the affine matrix to the given coordinate.


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.


matrix : ndarray

An NxN array representing the rotation matrix.

vector : ndarray

A 1xN array representing the translation.


xform : ndarray

An N+1xN+1 transform matrix.

See also


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

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


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.


transform : ndarray

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


matrix, vector : ndarray

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.