Coordinates from MNI to subject space using transform h5 file

Hi,

we need to transform coordinates that we have in MNI space into the subject space since we want to use them for transcranial magnetic stimulation.

Based on these posts MNI coordinates to subject's EPI and MNI to native space I understand that we can use the MNI_to_T1w.h5 file for this; however, I’m not familiar with this file type and I’m not sure what the folders 1 and 2 and their included arrays tell me.

In the second referred post, @Fidel states: “If you want to take the nonlinearity into account, you would need to combine the nonlinearity warp file and the MNI to subject transformation file and use the result as the warp file in std2imgcoord.” Does this mean I should simply use the whole h5 transformation file and a nonlinearity warp file? Is the nonlinearity warp file the anatomy in subject space? And how do I combine them for use in the FSL function?

Thanks a lot for your help!

Best wishes
Sandra

I am also interested in this. Would be great if @oesteban or @effigies could help out!

Hi,

I actually figured a way out using FSL with flirt. Unfortunately, it still doesn’t allow me to use the transformation matrix given in the output of fMRIPrep since I’m calculating a new matrix with flirt but at least I can use the output anatomy by fMRIPrep.

What you wanna do is:

  1. FLIRT coregistration with FSL (input image -> reference image)
    reference=some standard space image
    input=e.g. subject anatomy by fMRIPrep
    output=coreg.nii + source2dest.mat

  2. Convert coordinates from standard space to subject space:
    convert_xfm -omat inverted.mat -inverse source2dest.mat
    img2imgcoord -src standard space image -dest anatomy in subject space -xfm inverted.mat coord.txt

Hope this helps!

To project MNI coordinates back to BOLD, one would need to compose the following transforms (T3 ⚬ T2 ⚬ T1):

  1. T1w-to-MNI
  2. BOLD-to-T1w
  3. SDC fieldmap

A possibility for this is to use antsApplyTransformsToPoints, passing in the MNI coordinates as a CSV file and the transforms in the order above.

Example csv file contents:

x,y,z,meta1,meta2
0.1,0.3,-1.0,n/a,n/a
0.2,-0.5,2.0,n/a,n/a
...
1 Like