How can I check in which coordinate system fmri data is?

Hi all,

I have transformed fmri data into the MNI152 standard space using freesurfer as follows:
mni152reg --s subj1 (anatomical to MNI152 transformation)
fslregister --s subj1 --mov subj1_ref.mgh --reg register_01.dat --maxangle 70 --initxfm (functional to anatomical transformatiom)
mri_matrix_multiply -im register_01.dat -iim /subjects/subj01/mri/transforms/reg.mni152.2mm.dat -om reg.mn152.dat (multiply transformation matrices)
mri_vol2vol --targ MNI152_T1_3mm_brain.nii --mov subj1_fmri.nii --reg reg.mni152.dat --o subj1_fmri_mni152.nii (transform functional data into MNI152 space)

However, according to fslview, the data is still in the scanner anatomical space.
When I overlay the MNI152 template onto the data in fslview, the data, indeed, seems to match well with the template.

If I overlay the MNI152 template onto the data, fslview says that the coordinate system is MNI152 and shows coordinates of the cursor in that space.
If I keep the cursor in place and turn the visibility of the template off such that I can see the functional data, fslview shows exactly the same coordinates but says that the coordinate system is scanner anatomical.

I also noticed that if I load fmri data that is in MNI152 according to fslview into matlab using load_nii, save it using save_nii and open it again in fslview, the data is in scanner anatomical space according to fslview.

Could someone please let me know if there is some reliable way to check in which coordinate system the data really is?

Should I be worried if fslview says that the data is in the scanner space even if I have transformed it into MNI152 and if the data also seems to match with the MNI152 template?

Many thanks already in advance!


FSL has the fslhd tool to read the headers, and FreeSurfer has mri_info.

Assuming you’re looking at a NIfTI file, you’re looking for qform and sform information, and you can read more about those at Working with NIfTI images - The NIfTI affines.

This can be a bit fraught. Because the qform and sform matrices can differ and have different codes, the logic of how each tool reads and writes them can cause interpretations that differ across software. That said, the standard is very clear: if the sform code is non-zero, then the sform is the correct coordinate space. So you can take that for what it’s worth.

Worth noting:

  • ANTs/ITK does not respect the sform at all. It always uses the qform, even if the qform_code is 0.
  • AFNI does respect the affines according to the standard, but some tools do not write the correct q/sform_codes.
  • FSL I believe sets the qform_code to 0, but leaves it unchanged, updating the sform_code. So it depends on downstream tools correctly interpreting them, which obviously makes interacting with ANTs tools painful.

Finally, I would try fsleyes, which is more recently written and better maintained than fslview.