Fmriprep: applying transforms (from-orig_to-T1w_mode-image query)

Hello everyone,

I wish to use the transforms generated by fmriprep to normalise some other images (e.g. PET and ASL)

In the dataset each subject has two sessions. For e.g. session 1 my plan was to:

  1. Get session 1 PET image coregistered to session 1 anatomical image
  2. Then use _from-orig_to-T1w_mode-image_xfm.txt to get the PET image aligned with the averaged anatomical image
  3. Then use _from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 to move the PET image to MNI space

This is the same as suggested here:

After doing step 1 I would then do:

-i </path/to/pet.nii.gz>
-o </path/to/pet_space-MNI152NLin2009cAsym.nii.gz>
-r </path/to/reference_MNI_template.nii.gz>
-n NearestNeighbor
-t _from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
-t _from-orig_to-T1w_mode-image_xfm.txt

However this does not seem to be working well, and on further investigation it seems to me as though ‘_from-orig_to-T1w_mode-image_xfm.txt’ is in fact the transform for the averaged_anatomical ->session specific image rather than session specific image ->averaged anatomical?

If this is correct, is there a straighforward way to calculate the inverse transform?