Task-based fMRIprep + FLS (Doubts of Skull + Slice timing + confounds)

Hello everyone, I am currently running the preprocessing of my task-based data with fMRIprep, but I have some thoughts regarding it after comparing the process with the resting state output of fMRI in CON. Add that I am planing to do the first level analyses in FLS.

This are the characteristics of my task : Resolution: 2.5 × 2.5 × 2.5 mm, TE/TR = 40/2000 ms, Multiband factor = 4, 64 slices, 183 measurements. Duration: 7 m 12 seg. Partcipants: Old adults
REST 6.893
1 BACK 64.242
REST 26.9
2 BACK 64.242
REST 26.9
2 BACK 64.242
REST 26.9
1 BACK 64.242

  1. Should I remove the slice time correction from my functional task-based data in the preprocessing? Some recommendations for resting state data suggest avoiding it, so I am not sure if I should do it or not.

  2. After testing fMRIprep, I expected my images to be skull-stripped because the HTML file states: ‘The T1w-reference was then skull-stripped. For each of the 2 BOLD runs found per subject (across all tasks and sessions), the following preprocessing was performed: First, a reference volume and its skull-stripped version were generated by aligning and averaging 1 single-band references (SBRefs).’
    However, upon checking my images (sub-08_task-flanker_run-1_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz), I realized that this was not done. How should I add this to my fMRIprep script?"

  3. I have been reading about the confounds that I should include. The ‘winners’ could be the 6 motion parameters, their derivatives and squares, aCompCor regressors, and FD. However, I am not sure about this because other researchers recommend taking into account the length of my TR. Also, I read that I should check the matrix of regressors, but I don’t understand very well how to interpret it.

Thanks so much in advance.

Hi @Beatriz,

I recommend keeping it in, at a TR of 2 seconds.

It would help to see a pic and your original command.

That could be a lot of confounds, which would lead to loss of temporal degrees of freedom. If you have a lot of data (that is, number of volumes), you can afford to lose more, but you’ll probably get diminishing returns which the derivatives and squared expansions. There are also multiple strategies for acompcor (that is, top X components, e.g., 5 components, or enough components to explain X%, usually 50%).

The point is that you want to minimize the amount of confounds that strongly covary with each other. Including highly related confounds leads to multicollinearity in the models which tends to be bad.


Thanks so much for your response Steven, it was really useful.

This is the previus command that I used for fmriprep:

  mem=20 #gb 
  participant_labels=("sub-101" "sub-103")  # List of participant labels
  #participant_labels='sub-103'  # List of participant labels


  #Convert virtual memory from gb to mb
  mem=`echo "${mem//[!0-9]/}"` #remove gb at end
  mem_mb=`echo $(((mem*1000)-5000))` #reduce some memory for buffer space during pre-processing

  #export TEMPLATEFLOW_HOME=$HOME/.cache/templateflow
  #export FS_LICENSE=${bids_root_dir}/license.txt

  #Run fmriprep

for subj in "${participant_labels[@]}"; do
    fmriprep ${bids_root_dir} ${bids_root_dir}/derivatives \
      participant \
      --participant-label $subj \
      --skip-bids-validation \
      --fs-subject-dir /home/jovyan/neurodesktop-storage/Agueda/BIDS/derivatives/freesurfer/outputs \
      --md-only-boilerplate \
      --fs-license-file ${bids_root_dir}/license.txt \
      --output-spaces MNI152NLin2009cAsym:res-2 \
      --nthreads $nthreads \
      --stop-on-first-crash \
      --mem_mb $mem_mb \
      #-w ${work_dir}

However I decided to run fmrprep with the outputs previusly run on freesurfer adding this line to the previus code:

--fs-subjects-dir ${freesurfer_dir} \

but I got an error:

Node Name: fmriprep_23_0_wf.single_subject_101_wf.anat_preproc_wf.surface_recon_wf.autorecon1
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node autorecon1.

	recon-all -autorecon1 -noskullstrip -noT2pial -noFLAIRpial -cw256 -hires -openmp 3 -subjid sub-101 -sd /home/jovyan/neurodesktop-storage/Agueda/BIDS/derivatives/freesurfer/outputs -expert /neurodesktop-storage/Agueda/BIDS/derivatives/fmripreptask_fre/work/fmriprep_23_0_wf/single_subject_101_wf/anat_preproc_wf/surface_recon_wf/autorecon1/expert.opts -notalairach -nonuintensitycor -nonormalization
	INFO: hi-res volumes are conformed to the min voxel size

	ERROR: It appears that this subject ID is an existing
	       base/template from longitudinal processing (-base):
	       If you are trying to re-run a -base template you
	       need to pass the -base and all -tp flags: 

	       \' -base  -tp  ... -all \'

	       (Instead of -all you can pass other flags, such
	       as -autorecon2 -autorecon3 to run only parts.)

	RuntimeError: subprocess exited with code 1.

Hi @Beatriz,

At the moment, you cannot use longitudinal FS outputs into freesurfer, but incorporating these outputs appears to be a work in progress: Add a --fs-reuse-base option to reuse existing freesurfer outputs from a longitudinal pipeline by bpinsard · Pull Request #393 · nipreps/smriprep · GitHub


We have decided to use fmriprep sesion by sesion without the longitudinal tool for use the freesurfer outputs. However I still don’t have the images skull striped.

This is the comand that I used:
fmriprep /home/jovyan/neurodesktop-storage/Agueda/BIDS/derivatives/fmriprep_skul /home/jovyan/neurodesktop-storage/BIDS/derivatives/fmriprep_skul/derivatives/fmriprep participant --participant-label sub-101 --skip_bids_validation -v --skull-strip-t1w auto --fs-no-reconall --fs-license-file /home/jovyan/neurodesktop-storage/BIDS/derivatives/fmriprep_skul/license.txt --fs-subjects-dir /home/jovyan/neurodesktop-storage/BIDS/derivatives/freesurfer/outputs

nd this is the image that I have in the “func” folder, expecting a skull stripped image:

And even more because I add the comand skull-strip-t1 auto.

Thanks so much

Hi @Beatriz,

You could try --skull-strip-t1w force. But also you’ve only sent a pic of the BOLD file, not the T1.

This flag is not recommended, as it disables all surface-based workflows, including boundary based registration, which outperforms volume-based registration.

Can you overlay the BOLD brain mask on top of that image? If the brain mask looks okay you can just intersect the BOLD nifti with the brain mask.


In another try I saw that it was by default the force option and it was the same result.

Yes, the T1 is skull-stripped.

Should be also the BOLD one, right?

Thanks so much.

Hi @Beatriz,

Your BOLD file looks fine. As long as the brain mask is accurate (and you incorporate it into your analyses) you do not have to worry about non-brain signals in your analyses.