Rerunning fMRIPrep with new task over multiple sessions (different number of dummy scans)

I’m preprocessing a relatively large dataset with 3 functional tasks. Due to an error in the study setup, two of them have 4 dummy scans and one task has 3 dummy scans. I can’t see that there’s a way to address this within one fmriprep command, so at the moment my solution is to:

  1. run fmriprep for the two tasks which have 4 dummy scans, using the --bids-filter-file to specify that it should only run on the relevant two tasks, as below:
fmriprep-docker $bids_root_dir $save_dir \
		participant \
		--participant-label $subj \
		--bids-filter-file tasks_4dummys.txt \
		--md-only-boilerplate \
		--output-spaces MNI152NLin2009cAsym:res-2 \
		--fs-license-file $HOME/freesurfer/license.txt \
		--omp-nthreads 3 \
		--nthreads 12 \
		--stop-on-first-crash \
		--mem_mb $mem_mb \
		--dummy-scans 4 \
		--work-dir $save_dir/fmriprep_wd

where the tasks_4dummys.txt is:

{
	"bold": {"task": ["task-1", "task-2"], "session": ["1","2"]}
}
  1. then run fmriprep again with the following command, reusing the anatomical derivatives from previously:
fmriprep-docker $bids_root_dir $save_dir \
		participant \
		--participant-label $subj \
		--task-id task-3 \
		--anat-derivatives $save_dir/$subj/anat \
	    --md-only-boilerplate \
	    --output-spaces MNI152NLin2009cAsym:res-2 \
	    --fs-license-file $HOME/freesurfer/license.txt \
	    --omp-nthreads 3 \
		--nthreads 6 \
	    --stop-on-first-crash \
	    --mem_mb $mem_mb \
	    --dummy-scans 3 \
	    --work-dir $save_dir/fmriprep_wd

This seems to work ok, but it only seems to recognise the ses-1 data when running the the second command, so I end up with ses-1 data for all 3 tasks but ses-2 data only has 2 tasks (the BIDS validation at the start of the fmriprep command only recognises 1 session). Any ideas on why it’s doing this?

I tried specifying a new working directory but it didn’t make a difference, and if I try creating a file to use with --bids-filter-file which calls just task 3 and session 2, fmriprep crashes so it seems like it really can’t find the right files but I can’t work out why.

Hi,

I believe the dummy scans setting doesn’t change the actual output fMRI image, just the confounds file. So you can preprocess all of your data with 4 dummy scans setting in fmriprep, but then only use the first three dummy scan regressors when needed in your GLM modeling.

Best,
Steven