Fmriprep recon-all with multiple sessions T1w and T2w


We have a dataset with multiple sessions (10) per subject, where each session collected a T1-w and T2-w anatomical images. We assume that #fmriprep will perform freesurfer recon-all command on the average T1-w image.

However, after looking at the recon_all.log file, we think it is using the T1-w and T2-w images, but only from the first session. Therefore, we are not really sure, and are wondering whether it also calculates the average T2-w image and uses this in the recon-all command, or if not, how is it possible to do it or what is the recommended option?

Thanks for the help,

Hi Cesar, could you specify which fmriprep version are you working with?

With multiple T1w images, they are several ways that fmriprep can process them with help of freesurfer:
Some details are here:

And the updated FMRIPREP description is here:

About the T2 images, there is this information from @effigies :

I hope this helps!

Actually, in the most recent releases, T2w images are merged. Would need to check the release notes for when we did that. I want to say 23.0.

1 Like


Indeed, 23.0.0:

Additionally, T2w images are now resampled to the T1w-defined subject space if FreeSurfer reconstruction is used. If multiple T2w images are provided, they are merged into a single image first.

Hi @jsein @effigies thank you for your replies.
We are using version 23.0.2.
The command is
singularity run --cleanenv \
-B ${bids_data}:/input \
-B ${bids_derivatives}:/output \
-B ${work_dir}:/work \
-B ${freesurfer_license}:/license.txt \
-B ${filter_json}:/filter.json \
fmriprep-23.0.2.simg \
/input /output \
participant \
–fs-license-file /license.txt \
–skip_bids_validation \
–participant-label $subject \
–anat-only \
–bids-filter-file /filter.json \
–work-dir /work \
–output-spaces MNI152NLin6Asym fsLR T1w fsaverage fsnative func \
–nprocs 16 \
–omp-nthreads 16 \
–cifti-output 91k

Using --skip_bids_validation, because BIDS validation was run separately prior to running fmriprep

To the best of our understanding and based on your replies and documentation, we assume that all T1w images are aligned to the first session T1w, then averaged so that the average T1w image is input to freesurfer. Is that correct?

there’s just one sub-###_desc-preproc_T1w.nii.gz in the subject anat directory and the session specific anat directories only have one file: sub-###_ses-##_from-orig_to-T1w_mode-image_xfm.txt

Regarding the T2w image, we think that it actually use “the one that comes first in alphabetical order” as @effigies suggests. But, were the T2w images averaged as well and input to freesurfer?

Looking at the workflow, we still only pass the first T2w to FreeSurfer, but fMRIPrep combines the T2w and aligns them to the T1w image for its own derivatives.

You are welcome to take the combined T2w image and pass it to FreeSurfer and re-run recon-all -T2pial, and see if that makes any differences. I believe we did not use the combined T2w image because FreeSurfer itself does not take multiple T2w images, and we don’t know the justification for that decision. It may be that multiple T2w images are simply not a use case they’ve handled, and it may be that the risks of small misalignments harming the pial refinement could outweigh the gains from reduced noise. Without knowing more, it is hard to justify making that decision on behalf of users.

Ok, does it mean that the T1w average is also computed inside Freesurfer?

No, in that case, we do adopt FreeSurfer’s approach of using mri_robust_template, but to avoid possible divergence, we pass the result to Freesurfer as a single image, so FreeSurfer only sees one.