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
If you can get the voxel sizes and number of rows, cols, and slices, then the vox2ras-tkr is pretty easy to compute. Search our wiki for coordinates. This page will have a power point presentation that includes how to compute it. doug
On 3/21/13 10:02 PM, Eric Larson wrote:
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
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
freesurfer@nmr.mgh.harvard.edu