Using fMRIprep for preprocessing and SPM for first level and second level analysis

Dear All

I am performing my first fMRI analysis so I am creating my methodology. From people from my lab I have been promted to use fMRIprep for the preprocessing of my data.

I was wondering if it is in principle possible (and sound) to use fMRIprep for the preprocessing and SPM12 for first and second level subject analysis.

Has anyone in the community tried that? Are there any caveats?

Thank you very much

1 Like

Hi,
I our lab several people use this approach (FMRIPREP for preprocessing and SPM for analysis) which is both possible and sound. The alternative would be to stay within SPM for the whole process (preprocessing + analysis).
Some researchers however ask their students to start building their own SPM script for preprocessing and analysis before using fmriprep to help them understand really what is going on behind each preprocessing step.

We ran some comparisons to compare the results of the preprocessing stage from SPM and FMRIPREP and their impact on the statistical analyses: we were not able to find any significative difference from our data. One advantage with FMRIPREP is that all the transformations are applied at once, inducing only one interpolation step to the data. I think there is at least one more interpolation step in SPM when using the realign and unwrap option wich adds a little bit of blurring to the data but it is negligible in general.

On the bright side of FMRIPREP you will find it working out of the box if your dataset is in BIDS format, it provides nice quality checks to see if the different processing stages went well and it is community driven with state-of-the art implementations generally available. Also FMRIPREP outputs can right away be used as inputs for several nice software: CONN, XCPEngine, denoiser, fmridenoise, just to cite a few.

But nothing is perfect, if you read the issue panel in the FMRIPREP GitHub, you will notice that there is still room for improvement for FMRIPREP.

From my point of view there is nothing wrong in picking one approach of the other but some people may argue differently.

One last point, there are also many other great tools for fmri preprocessing and analyses:
HCPPipeline, FSL, AFNI, CONN …

Good luck with your first analysis!

3 Likes

Using SPM to analyze fMRIprep output is definitely doable and has been done.

On a more pragmatic side the bids-matlab “toolbox” should soon allow you to more easily index and query the content of a fMRIprep dataset to help you easily find and return all the files you are looking for and their associated metadata.

A bit like pybids does for python.

Technically the part of the toolbox that is in development can already do that.

Definitely looking for testers, users, contributors and feedback.

The doc is way too light (sorry :see_no_evil:) at the moment but I can work on improving the jupyter book / binder example to give more guidance.

1 Like

Thank you very much for your detailed response. This has been really useful.

Thank you very much for this. I will be sure to check this out!

Have a great day.

Hi thank you very much for your answer ! We are also trying to analyse our fMRIprep outputs using SPM in MATLAB and it is great to see it has been done and is supposed to work !
I took a look at the toolbox you suggested but I don’t understand what is does exactly, besides reading BIDS datasets. Is it supposed to make a connection between fMRIprep outputs and MATLAB ?

The main function is to facilitate ‘queries’ to a BIDS dataset

Say you have some fMRIprep output on a dataset that contains 3 “tasks” (seeingFaces, seeingHouses, rest), with 30 subjects, normalized in 2 different spaces (T1w, MNI), that the same protocol was done on 2 sessions (ses-1 and ses-2) that you have 10 runs for each participant.

How do you “select” (when scripting) only the preprocessed files, their corresponding TSV, their confounds (realignement parameters and others) to build your GLM, for subject 7 and 15, of the session 2 for run 3 and 8 in T1w space for the seeingFaces?

% index fmriprep data to get BOLD and confounds
BIDS = bids.layout(path_to_fmriprep_data);

% query for the right files
bold_files = bids.query(BIDS, 'data', ...
                         'sub', {'07', '15'}, ...
                         'ses', '2', ...
                         'space', 'T1w', ...
                         'task', 'seeingFaces', ...
                         'run', {'03', '08}, ...
                         'desc', 'preproc', ...
                         'suffix', 'bold');

confound_files = bids.query(BIDS, 'data', ...
                         'sub', {'07', '15'}, ...
                         'ses', '2', ...
                         'space', 'T1w', ...
                         'task', 'seeingFaces', ...
                         'run', {'03', '08}, ...
                         'suffix', 'timeseries');

% index raw data to get events.tsv files
BIDS = bids.layout(path_to_raw_data);
events_files = bids.query(BIDS, 'data', ...
                         'sub', {'07', '15'}, ...
                         'ses', '2', ...
                         'task', 'seeingFaces', ...
                         'run', {'03', '08}, ...
                         'suffix', 'events');

In the lab where I work we use bids-matlab a lot to build our SPM pipelines
See there GitHub - cpp-lln-lab/CPP_SPM: code base for SPM-based analysis with BIDS datasets

1 Like