Running common preprocessing steps after fMRIprep
by Florian Krause & Martin Krentz
fMRIprep stops preprocessing after normalization. Often you also need your data to be spatially smoothed and/or temporally highpass-filtered. Finish the job is a convenient way to do this by simply specifying the directory of the preprocessed data from fMRIprep, a list of subjects to run it on, and a pipeline that specifies the details of the additional preprocessing steps to run, as well as their order. All bold
images of the specified subjects found in the fMRIprep directory will be processed.
Currently available preprocessing steps:
- "spatial_smoothing"
- spec: FWHM kernel size in millimeter (numeric)
- "temporal_filtering"
- spec: highpass and lowpass filter sizes in seconds (list)
- "timecourse_normalization" (Note: also performs brain extraction!)
- spec: normalization methods ("Zscore" or "PSC")
Pipelines are simply dictionaries with preprocessing steps as keys and their specs as values.
Example pipeline {"spatial_smoothing": 5, "temporal_filtering": [100, None], "timecourse_normalization": "Zscore"}
:

Preprocessed images are saved next to the input images, with the desc
field updated to reflect the preprocessing details (preproc5mm100sNoneZscore
in the above example).
- Install FSL
- Install graphviz
- Install nipype, niflow-manager and niflow-nipype1-workflows with
pip3 install nipype niflow-manager niflow-nipype1-workflows
- Download Finish the job
- Install with
(replace X.X.X with latest release version)
pip3 install finish-the-job-X.X.X.zip
If you are working on the compute cluster of the Donders Institute, please follow the following steps:
- Load Anaconda3 module by running command:
module load anaconda3
- Create new environment in home directory by running command:
cd && python3 -m venv ftj_env
- Activate new environment by running command:
source ftj_env/bin/activate
- Install Nipype, Nifow-manager into environment by running command:
pip3 install nipype niflow-manager niflow-nipype1-workflows
- Download Finish the job
- Install with
(replace X.X.X with latest release version)
pip3 install finish-the-job-X.X.X.zip
Example:
from finish_the_job import finish_the_job
finish_the_job(fmriprep_dir="/path/to/fmriprep_dir/",
subjects=[1,2,3],
pipeline = {"spatial_smoothing": 5, # Step 1: spatial smoothing with 5 mm kernel
"temporal_filtering": [100, None], # Step 2: highpass filtering with 100 s filter size
"timecourse_normalization": "Z", # Step 3: Z-normalization of voxels timecourses
})
If you are working on the compute cluster of the Donders Institute, please follow the following steps:
- Start a new interactive job by running command:
qsub -I -l 'procs=8, mem=64gb, walltime=24:00:00'
- Load Anaconda3 module by running command:
module load anaconda3
- Load graphviz module by running command:
module load graphviz
- Activate environment by running command:
source ftj_env/bin/activate
- Write script
mystudy_ftj.py
with custom workflow; example:from finish_the_job import finish_the_job finish_the_job(fmriprep_dir="/path/to/fmriprep_dir/", subjects=[1,2,3], pipeline = {"spatial_smoothing": 5, # Step 1: spatial smoothing with 5 mm kernel "temporal_filtering": [100, None], # Step 2: highpass filtering with 100 s filter size "timecourse_normalization": "Zscore", # Step 3: Z-normalization of voxels timecourses })
- Run script by running command:
python3 mystudy_ftj.py