NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.orientations.orientation_affine

Next topic

nibabel.orientations.flip_axis

This Page

Reggie -- the one

nibabel.orientations.apply_orientation

nibabel.orientations.apply_orientation(arr, ornt)

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

orientation transform. ornt[N,1]` is flip of axis N of the array implied by `shape`, where 1 means no flip and -1 means flip.  For example, if ``N==0 and ornt[0,1] == -1, and there’s an array arr of shape shape, the flip would correspond to the effect of np.flipud(arr). ornt[:,0] is the transpose that needs to be done to the implied array, as in arr.transpose(ornt[:,0])

Returns :

t_arr : ndarray

data array arr transformed according to ornt