What does fMRIPrep do with T1w with --longitudinal?

Hi all,

I was wondering what fMRIPrep is doing exactly with multiple T1’s for multiple sessions per subject. We have a study design with multiple measures over a longer period. We expect that T1’s will change over time substantially. From the explanation of fMRIPrep’s website, I understand that if there are more than 2 sessions (which we do have), it constructs an ‘unbiased’ T1 template (if you use the flag --longitudinal). What does this mean exactly? That the BOLD fmri’s are registered to the session-specific T1’s? (without averaging them over sessions)
What we want to avoid is averaging out differences in the T1s over the sessions.
Do you have any recommendations about how to proceed, whether or not to use the --longitudinal flag?


The --longitudinal flag tells fMRIPrep to try to find a template T1w image that is equidistant from all time points, rather than aligning to the first time point. This takes significantly longer, as it’s an iterative process, but I don’t have a sense of how it scales with number of time points.

The idea of the flag was to generally adjust processing to be more appropriate for longitudinal use cases, but that was the only change ever made, so it’s not very useful and is probably more confusing than helpful.

Our current contributors have done little (if any) longitudinal work, which is why support is so minimal. We would be happy to talk about what changes are needed to address the challenges of longitudinal use cases.

An alternative would be to use --bids-filter-file to specify to only use files from a certain session (which in your case may correspond to a longitudinal timepoint). Just note that you would not be able to reliably compare timepoints within subjects in subject space if you do this, since the T1s as you already pointed out will be appreciably different.


Hi Julia, I have a dataset in need of the same functionality as you. Mine has a baseline session and a session after 1 year, and I expect there to be some changes in the T1s over the course of the year.

For now, similar to @Steven’s comment, I have been using a bids-filter json file to specify the session I want (eg. baseline), which I include in my fmriprep command with the flag --bids-filter-file. I then run fmriprep separately for my two sessions (if you have more, you would need to run it once for every session) and have each write to a different output directory to avoid overwriting of any directories or files with non-unique names. Lastly, I run a script to merge my two output directories into a single output directory in bids format. I know it’s a little annoying to do it this way, but it works.

I hope this helps!

PS (@effigies): Perhaps in the future fmriprep could have an option for this kind of longitudinal processing to avoid having to merge output directories at the end. I would really appreciate this!