Skip to content

Add support for vox2ras-tkr reading in .mgz files #163

@larsoner

Description

@larsoner

In order to use orig.mgz files to transform surface vertex locations to MNI coordinates, two pieces of information must be extracted from orig.mgz. The first is the vox2ras transformation, accessible via $ mri_info --vox2ras orig.mgz using Freesurfer or in nibabel:

import nibabel as nib
img = nib.load('orig.mgz')
img.get_affine()
# or
img.get_header().get_vox2ras()

However, the second necessary piece of information stored in orig.mgz is the vox2ras-tkr matrix, accessible via $ mri_info --vox2ras-tkr orig.mgz. There is currently no way (that I know of) to get this information in nibabel. It would be great if this info could be added so that Freesurfer command-line dependencies could be removed (e.g., mne-tools/mne-python#524).

For reference in the associated transform, see the MNI305RAS conversion:
http://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions