Does anyone have code available for reading the vox2ras-tkr transform from
.mgz files? I am working on implementing the transform outlined on the
Freesurfer wiki:
MNI305RAS = TalXFM*Norig*inv(Torig)*[tkrR tkrA tkrS 1]'
TalXFM: subject/orig/transforms/talairach.xfm
Norig: mri_info --vox2ras orig.mgz
Torig: mri_info --vox2ras-tkr orig.mgz
I can get vox2ras-tkr (a.k.a., Torig) using mri_info, but it would be
better if they were available in the python package nibabel for use in
mne-python (for easy conversion from surface to MNI coordinates). nibabel
already supports reading the --vox2ras transform, but I need to code the
other one in order to avoid a dependecy in our code. Does anyone have code
to extract that information? MATLAB, Python, C code, or heck, even
pseudocode would help. If not, if anyone has helpful information on the
specs on the .mgz specification, maybe it won't be too difficult to code
from scratch...
Eric