How to best organize a a unique longitudinal dataset for fmriprep

Hi all, I’m hoping to run a somewhat unique dataset through fmriprep and I’m not 100% sure how to organize it for best preprocessing. A child was scanned multiple times across several years. Each year, they were scanned over ~3-4 days over the course of a month. Several days had both morning and afternoon sessions. T1w’s were collected each day, but if there were multiple sessions in a day, only 1 T1w was collected. Not every day had multiple sessions, and some days had 3-4 sessions.

So for example, I have data like this: (this is made up, but to give you an idea)
May 25, 2015 morning: T1w + fieldmaps + resting scan
May 25, 2015 afternoon: fieldmaps + resting scan
May 30, 2015 morning: T1w + fieldmaps + resting scan
May 31, 2015 morning: T1w + fieldmaps + resting scan
May 31, 2015 afternoon: fieldmaps + resting scan
May 31, 2015 evening: fieldmaps + resting scan
April 6, 2016 afternoon: T1w + fieldmaps + resting scan
April 15, 2016 morning: T1w + fieldmaps + resting scan
April 15, 2016 afternoon: fieldmaps + resting scan
April 20, 2016 morning: T1w + fieldmaps + resting scan
April 20, 2016 afternoon: fieldmaps + resting scan
May 2, 2016 morning: T1w + fieldmaps + resting scan

Since this is a child, you’d expect some amount of developmental changes from year to year.

I’m not sure whether I should arrange things where every session is its own session in fmriprep, i.e., my made up scan history would be 12 sessions. Or I could treat things collected on the same day as part of the same session, so I’d have 7 sessions. Or I could treat each year as its own session.

By the way, while I’m open to ideas on how to actually analyze the data, I’m mostly interested in how to get fmriprep to run as smoothly as possible! Thanks for your help.

-Kirk

Hi @Kirk_Graff and welcome to neurostars!

I think you could justify doing 1 day per session or each time in a scanner as a session as long as it is clear in the README.

A bit more information could help here. Was the collection consistent across children? That is, if one day had multiple or only one session for one child, was it the same for each other child? This would help decide on what would make a good session name. But really, you could use whatever you think makes the most sense for session name as long as it is clear in the README.

Okay, that’s it for BIDS, now for fMRIPrep. Keep in mind…

… do you want to use 1 template for all sessions or use separate templates for different developmental stages? Either of the organizations should work for fMRIPrep, as long as there is at least one T1w available across the data being considered in a run. If you want to use separate T1 runs then you’ll need to use a BIDS filter file and make sure you keep the FreeSurfer outputs separate for each fMRIPrep run.

Does this make sense?

Best,
Steven

1 Like

+1 to all @Steven wrote. But I just want to say: The point of BIDS is to encode your dataset in a way that is human understandable and machine-queryable, not to be an input format for fMRIPrep. While I would make changes to satisfy the BIDS validator, as that’s intended to ensure that the dataset is BIDS-compliant, I would not make changes to modify fMRIPrep.

Instead, the BIDS filter file that Steven mentioned is the tool I would reach for in these unique cases. See the FAQ - Frequently Asked Questions — fmriprep version documentation for more.

1 Like

Hi @Steven, thanks for the welcome!

This dataset is only the one, highly sampled child, so I have even more leeway on how to organize things. Will have to properly describe things in the readme, of course!

I’m not too interested in structural changes at the time being, so I think 1 template for everyone would work.

I am concerned about runtime, not having to start over from the beginning if my computer crashes or there’s an error, and ideally I’d like to have things running in parallel. Altogether for this one participant there are ~25 T1ws, and ~100 bold files. Any advice on how to actually run fmriprep given this? For example, could I run all the structural preprocessing first, then parallelize the functional preprocessing across multiple computers? I’ve never used fmriprep before, so specific commands would be helpful where possible.

Thank you!

-Kirk

Hi @Kirk_Graff,

It would help if you could give us some context about your computing infrastructure.

It’s okay to not be interested in structural change, but I was more asking are you worried about structural change, such that a single template across all T1s wouldn’t be “valid” due to amount of change across images. If you are okay with making a single template, then that makes processing easier.

fMRIPrep can handle everything in a single command if there’s enough RAM and runtime devoted to the job. I do not have a good estimate on what is needed to handle everything for that subject, though.

woah. When using the --longitudinal flag for fMRIPrep, which is typically recommended for longituindal studies, an unbiased T1 template is made from all the T1s. Runtime scales up pretty sharply after 3 or 4 T1s. For 25… When you do not use the --longitudinal flag, a template is made but it is aligned to the first T1. Again, I do not know your processing power, you can always give --longitudinal a shot, but if it takes too long, you can try not using the flag.

fMRIPrep benchmarks as it goes, so even if something crashes and you have to restart, the process will restart from where it left off (as long as the same working directory is specified each time you run fMRIPrep).

I’d refer you to the documentation first, but let us know if something is unclear: Usage Notes — fmriprep version documentation

Best,
Steven

It would help if you could give us some context about your computing infrastructure.

If we can get it set up, I’m hoping to run everything through an AWS server. So very easy to parallelize, if that’s possible, but can also just simulate a computer with lots of RAM that’ll run for several days.

It’s okay to not be interested in structural change, but I was more asking are you worried about structural change, such that a single template across all T1s wouldn’t be “valid” due to amount of change across images. If you are okay with making a single template, then that makes processing easier.

While I am a bit concerned about change, I think the upside of having the functional images better aligned, at least in theory, makes up for it.

woah. When using the --longitudinal flag for fMRIPrep, which is typically recommended for longituindal studies, an unbiased T1 template is made from all the T1s. Runtime scales up pretty sharply after 3 or 4 T1s. For 25… When you do not use the --longitudinal flag, a template is made but it is aligned to the first T1. Again, I do not know your processing power, you can always give --longitudinal a shot, but if it takes too long, you can try not using the flag.

While I think about this, I know that the very first T1w happens to be fairly low quality due to motion artifacts. Is this a concern, and/or is there a way to align to a different T1w?

fMRIPrep benchmarks as it goes, so even if something crashes and you have to restart, the process will restart from where it left off (as long as the same working directory is specified each time you run fMRIPrep).

Good to know!

Also, a tangentially related question. I was looking through old forum posts. Do fieldmaps still require the “intended for” field to be applied to a specific bold image? Or does fmriprep make assumptions that the ses5/fmap fieldmaps will apply to the ses5/func images? It sounded like there was some talk of implementing that, but no idea if that went anywhere.

Thanks for all the help.

-Kirk

I doubt this would be a concern, but it’s always worth testing it out. If the output looks unusable you can use a BIDS filter file to ignore it, use the --longitudinal flag, or just delete the file if you don’t think there’s any use for it.

Yes. Either that or the B0FieldSource/B0FieldIdentifier pair. This explicit pairing is safer than making those kinds of assumptions.

Best,
Steven