Transformation matrices 'from-T1w_to-scanner_mode' dropped from fmriprep

Summary of what happened:

Hi, I recently updated fmriprep to the latest version (23.2.0) - and I noticed that the transformation from T1w to scanner_mode has been dropped from the output. Specifically, in the previous version that I was using (23.0.0), in the output directory //func/ there was the transformation matrix __task-rest_from-T1w_to-scanner_mode-image_xfm.txt which is no longer in my output from v23.2.0.

I have run into a couple of issues with this:

  1. I was using these transformations to transform anatomical masks to BOLD space (rather than transform every volume into anat space).
  2. Additionally, I believe it might have led to this error message I received from post-fmri processing with xcp_d on the output from fmriprep (v23.2.0):
    'FileNotFoundError: No anat_to_native_xfm file found for derivatives/fmriprep/<sub>/<ses>/func/<sub>_<ses>_task-rest_space-MNI152NLin6Asym_desc-preproc_bold.nii.gz'

Is there a reason why these transformation matrices were dropped from fmriprep output?
Is there a better way that I should be performing transformations with the frmiprep output?

Thanks for your help!
Nathan

Command used:

singularity run --cleanenv -H /home/nathanc /home/nathanc/simgs/fmriprep-23.2.0.simg \
/home/nathanc/<project>/BIDS/mbme/spinecho/ /home/nathanc/<project>/BIDS_DERIVS/fmriprep/mbme/spinecho/ \
-w /home/nathanc/<project>/work/mbme/spinecho/ participant --participant-label 004 \
--me-output-echos -vv --fs-license-file /home/nathanc/<project>/fs_dir/license.txt \
--output-spaces MNI152NLin2009cAsym --nthreads 12 --skull-strip-t1w skip

**NOTE** the command was exactly the same for both fmriprep versions, just with a different .simg

Version:

23.2.0 (vs 23.0.0)

Environment:

Singularity


The main reason they were dropped was because I was attempting to rewrite the workflows to produce and then work from a set of core derivatives, and I neglected to re-add inverses for most affine transforms.

If you’re using antsApplyTransforms, you can just use -t [$boldref2t1w,1] to invert the transform internally. If you need to invert them first in order to work with tools that can’t do this, you can use Convert3d:

c3d_affine_tool -itk $boldref2t1w -inv -oitk $t1w2boldref

Affine transforms are small, so it wouldn’t be a large burden for fMRIPrep to resume generating them if it is very inconvenient for users. I rarely need explicit inverse files, but my use cases are not the final word.

Thanks for your reply! Creating the inverse transform as you suggested with Convert3d works fine for my purposes (adding just 1 extra line to my pipeline).

However I just tested it, and indeed the above error with xcp_d does not occur when the inverse transform _task-rest_from-T1w_to-scanner_mode-image_xfm.txt exists, suggesting they require this transform for the xcp_d pipeline to run correctly. If it isn’t too inconvenient, adding this transform back in might save them having to update their pipeline. But I’ll let you decide where the onus lies in that regard.

Thanks for this wonderful resource!

@tsalo What does XCP-D need here? Just updating to accept the new output layout, or do you need these transforms?

It looks like I removed the need for native-space transforms in XCP-D version 0.6.0. @nathanecross what version of XCP-D are you using?

Oops, my bad! I thought I was on the latest version but I was using 0.5.1. I will update.

Good to hear you are on top of it. And thanks again for the support!