Multiple scan sessions some bad anatomicals



That’s good to know. Can that interact with the longitudinal flag/analysis if that is being used?

I wonder if there can be a future version of BIDS where we can flag/organize rejected data without deleting it altogether.


Potentially yes, but do you want to consider your T1w data longitudinal?

That will need someone to propose it and submit a PR to the bids-specification repo. If you were to push on that, this conversation will show you what are the potential argument in favor/against such new semantics.


The reason for longitudinal is that in some cases I have 2 sessions close together in time and then 2 more a couple of years later. one of the 4 sessions has a bad anat.

In other cases I have only 2 sessions (close in time) and one anat is bad. In which case, this can be analyzed without the longitudinal flag.


I meant “longitudinal” in an anatomical sense. In other words, do you expect substantial anatomical changes between sessions? By substantial I mean, e.g., a surgery or images were acquired 20 years apart.

Pre-run, multi-session FreeSurfer and fMRIPrep

Got it. Some participants are a developmental sample. So in principal a couple of years can make an anatomical difference.

I can probably run different subs with different flags in a way that makes most sense for the individual in question.


What is the age range?


as little as 7 during first scan sessions.


I guess then you should treat sessions as different subjects in that case.


That’s interesting. Howcome?


Because for fMRIPrep, the anatomy is relevant to place things around. When there are no big anatomical changes, we average the T1w images across sessions to remove noise. Treating sessions as individual participants will help registration steps to be more accurate. If anatomy changes a lot between sessions, the averaging is not going to do any good.


@oesteban How do you recommend treating each session as a different participant from BIDS format of /sub/ses (each of my participants have 2 sessions). Or is it already treated as different participants when separated like that?


Can you give me more context? Is your problem exactly the same posted on top?


@oesteban not exactly the same. But I have 2 sessions per participant. I don’t expect any significant anatomical differences between time-points (~3 weeks). How should I treat each session? You mentioned treating as individual participants-- does that mean I have to do something different when running fmriprep/organizing folders?

Also, I have pre-run freesurfer for each of the sessions, how should I organize these in the out/freesurfer/sub-xxx folders before running fmriprep? I’m not sure how to incorporate 2 sessions in the freesurfer folders. Or do I only need 1 of the sessions in there?

Thanks for the help.


Just do not set the --longitudinal argument nor split them into different subjects.

In general, fMRIPrep will run the averaging of the 2 T1w images on its own. You may want to re-run freesurfer via fMRIPrep. If not, it should just work.


Ok, thanks. We want to use our pre-run freesurfer since it’s been QC’d and run through our pipeline. However, I still don’t understand how to incorporate 2 sessions of freesurfer data into the fMRIPrep /out/freesurfer/sub folders. For example, if I create a folder for sub-123 in that fMRIPrep directory/folder, I can only put in one set of pre-run freesurfer outputs (i.e. label, mri, scripts, stats, surt, tmp, touch, trash). When pasting in more than one I get issues with duplicate names. I tried to work around this by creating one more layer of folders (ses-1a, ses-2a), but this caused errors when running fMRIPrep.

Thank you for the help as we would prefer to use our pre-run freesurfer from both sessions before running fMRIPrep.


Here there are some tips to run fMRIPrep reusing a FreeSurfer folder:



Regarding using pre-run freesurfer outputs. I have succesfully done so when each ‘sub’ has only 1 session. However, I am trying to place Freesurfer outputs for session two now (in /fmriprep/out/freesurfer), but since the folders there are organized by ‘sub’ level I can’t place another folder for session two with the same name. How should I include 2 timepoints/sessions of pre-run Freesurfer data? Can the Freesurfer ‘sub’ folders also contain ‘ses’ subfolders?


1 Like

I tried placing the pre-run FS files in these sub-folders:


but that resulted in error. fMRIPrep finished without proper func outputs. I don’t fully understand the error, but it seems it may have to do with FS. Any help would be appreciated, thank you.


I’m not sure to what extent they are applicable to the current version of fmriprep, but here are some relevant github threads. Fmriprep will fuse and conform across sessions for raw data, so presumably it would not support multi-session freesurfer outputs. effigies suggested using --session-label option to run separately for each session, but at the time of writing that was not supported (and it may still not be).

1 Like

Hello again,

@AnonymousBoba, thank you for those links.

@oesteban, thank you for sharing you slides on fMRIPrep. Just a few clarification questions regarding the workflow in general, and the use of FreeSurfer.

Our study has two scan sessions, each with its own T1 and subsequent FreeSurfer processed data. We are examining change across time in our specific patient population and expect morphological changes between scan sessions. Therefore, we want to use QC’d FreeSurfer outputs for each session’s T1 in fMRIP prep and separately process fMRI data for each session.

For example,
• Scan session 1: we need to use scan session 1 T1/FreeSurfer for scan session 1 fMRIPrep Processing.
• Scan session 2: we need to use scan session 2 T1/FreeSurfer for scan session 2 fMRIPrep Processing.

However, our BIDS formatting treats each subject as one subject, with separate scan sessions for each session. Given this file structure, I don’t see a way to split FreeSurfer sub directories in fMRIPrep to use separate T1/FreeSurfer data from each session for processing each session fMRI data.

For example, here: > B:\InProcess\3T\NABM\fMRI\BIDS\derivatives\fmriprep-1.3.2\out\freesurfer\sub-123

In the folder structure above, I am unable to place two sessions of pre-run FreeSurfer outputs (i.e. surf, mri, label, etc…) because both session’s folders have the same names (i.e. surf, mri, label, etc…).

So, I tried doing something like this, but it did not work:


Is there any way I can ensure each fMRI session uses its session specific pre-run FreeSurfer outputs?

Or is the only alternative to change our naming system in my BIDS script that treats each session as a new subject, for example, something like \sub-1231a and \sub1232a

We would prefer not to have to change our BIDS naming structure in order to use separate T1/FreeSurfer output for each of our sessions. If there is any way to do this without having to take that step, please let us know. I have not been able to find much about this specific issue.

Thank you for the help!