Inheritance diagram for nipy.core.transforms.affines:
Functions working on affine transformation matrices.
The orientation functions below also exist in nibabel as orientations.py
Apply transformations implied by ornt to the first n axes of the array arr
Parameters : | arr : array-like of data with ndim >= n ornt : (n,2) orientation array
|
---|---|
Returns : | t_arr : ndarray
|
Flip contents of axis in array arr
flip_axis is the same transform as np.flipud, but for any axis. For example flip_axis(arr, axis=0) is the same transform as np.flipud(arr), and flip_axis(arr, axis=1) is the same transform as np.fliplr(arr)
Parameters : | arr : array-like axis : int, optional
|
---|---|
Returns : | farr : array
|
Examples
>>> a = np.arange(6).reshape((2,3))
>>> a
array([[0, 1, 2],
[3, 4, 5]])
>>> flip_axis(a, axis=0)
array([[3, 4, 5],
[0, 1, 2]])
>>> flip_axis(a, axis=1)
array([[2, 1, 0],
[5, 4, 3]])
Combine a matrix and vector into a homogeneous affine
Combine a rotation matrix and translation vector into a transform in homogeneous coordinates.
Parameters : | matrix : array
vector : array
|
---|---|
Returns : | xform : array
|
See also
Orientation of input axes in terms of output axes for affine
Valid for an affine transformation from m dimensions to n dimensions (affine.shape == (n+1, m+1)).
The calculated orientations can be used to transform associated arrays to best match the output orientations. If n > m, then some of the output axes should be considered dropped in this orientation.
Parameters : | affine : (n+1,m+1) ndarray-like
|
---|---|
Returns : | orientations : (n,2) ndarray
|
Affine transform resulting from transforms implied in ornt
Imagine you have an array arr of shape shape, and you apply the transforms implied by ornt (more below), to get tarr. tarr may have a different shape shape_prime. This routine returns the affine that will take a array coordinate for tarr and give you the corresponding array coordinate in arr.
Parameters : | ornt : (n,2) ndarray
shape : length n sequence
|
---|---|
Returns : | transformed_affine : (n+1,n+1) ndarray
|
Split a transform into its matrix and vector components.
The tranformation must be represented in homogeneous coordinates and is split into its rotation matrix and translation vector components.
Parameters : | transform : array
|
---|---|
Returns : | matrix, vector : array
|
See also