NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.trackvis.TrackvisFile

Next topic

nibabel.trackvis.aff_to_hdr

Reggie -- the one

nibabel.trackvis.aff_from_hdr

nibabel.trackvis.aff_from_hdr(trk_hdr)

Return voxel to mm affine from trackvis header

Affine is mapping from voxel space to Nifti (RAS) output coordinate system convention; x: Left -> Right, y: Posterior -> Anterior, z: Inferior -> Superior.

Parameters :

trk_hdr : mapping

Mapping with trackvis header keys version, image_orientation_patient, voxel_size and origin. If version == 2, we also expect vox_to_ras.

Returns :

aff : (4,4) array

affine giving mapping from voxel coordinates (affine applied on the left to points on the right) to millimeter coordinates in the RAS coordinate system