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?
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:
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
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