NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.orientations.ornt2axcodes

Next topic

nibabel.orientations.apply_orientation

Reggie -- the one

nibabel.orientations.aff2axcodes

nibabel.orientations.aff2axcodes(aff, labels=None, tol=None)

axis direction codes for affine aff

Parameters:

aff : (N,M) array-like

affine transformation matrix

labels : optional, None or sequence of (2,) sequences

Labels for negative and positive ends of output axes of aff. See docstring for ornt2axcodes for more detail

tol : None or float

Tolerance for SVD of affine - see io_orientation for more detail.

Returns:

axcodes : (N,) tuple

labels for positive end of voxel axes. Dropped axes get a label of None.

Examples

>>> aff = [[0,1,0,10],[-1,0,0,20],[0,0,1,30],[0,0,0,1]]
>>> aff2axcodes(aff, (('L','R'),('B','F'),('D','U')))
('B', 'R', 'U')