Fmriprep pipeline and output

Hi, I have two questions regarding the output of fmriprep:

  1. I see here: fMRIPrep: A Robust Preprocessing Pipeline for fMRI Data — fmriprep version documentation that the data is normalized but not detrend. So, when using nilearn.image.clean_img to read it, it’s advisable to use detrend=True (as it is the default), but to override default and use standardize=False? (since fmriprep already dealt with this).
    In what cases it is recommended to use high_pass / low_pass filters?
  2. I read the spec about the output here: Outputs of fMRIPrep — fmriprep version documentation but I am not sure when to use desc-preproc_bold.nii.gz and when to use MNI152NLin2009cAsym_res-native_desc-preproc_bold.nii for the analysis? (I want to build encoding models based on the BOLD data)


  1. I think your intuition is right here. High and low pass filtering is advised in most cases, although the parameters may depend on the application. For reference you should try to find a recent paper similar to what you are trying to do and see how they filter. fMRIPrep does not apply filtering.
  2. fMRIprep should not output any pure .nii files, only .nii.gz. In either case, you should probably work with whichever *desc-preproc_bold.nii.gz file is in the space you want to work with.

@Steven Thanks, so just to make sure I read the post fmriprep file correctly:

from nilearn.input_data import MultiNiftiMasker, NiftiMasker
from nilearn import image

roi_mask_path =  "./hearing_association-test_z_FDR_0.01.nii.gz" #mask taken from
roi_mask_img = image.math_img("img>0", img=roi_mask_path)
roi_mask = NiftiMasker(mask_img=roi_mask_img)
bold_nii = image.clean_img(nii_file)
roi_bold = roi_mask.transform(bold_nii) 

Now, in roi_bold I get the bold activity in the ROI, to work with in order to build my model.

Is that correct?


Something like that should work, however , you should pass in a subset of your fmriprep confounds to the cleaning step.

@Steven What columns I should take?
The confounds_regressors.tsv file has 227 columns, some has nan (the causes clean_img to throw an error)

That depends on your application, but you may find this tool (and reading through the documentation) helpful:

@Steven When taking the columns ['framewise_displacement','t_comp_cor_00','t_comp_cor_01','t_comp_cor_02','t_comp_cor_03', 't_comp_cor_04'],
I have a single cell that is nan for framewise_displacement which raises the error:
{ValueError}array must not contain infs or NaNs ,
any idea what can be done or how it is usually handled?

It’s probably the first cell of framewise replacement, which can be replaced with a 0.

@Steven I came across some cases where I only have the columns 't_comp_cor_00','t_comp_cor_01','t_comp_cor_02','t_comp_cor_03' but not ‘t_comp_cor_04’ or ‘t_comp_cor_05’. (sometime only 00-04). Any idea why? Per fmriprep docs I should see all
Any idea why?

Compcor is a PCA-based approach, and it is not necessarily true that the same number of components will describe sufficient variance across subjects. This paper should help: A Component Based Noise Correction Method (CompCor) for BOLD and Perfusion Based fMRI

Also, can I ask why you are using tcompcor? More often, acompcor is used instead.

@Steven You are correct, after looking again at the doc of fmriprep output I won’t use it