Usage

The qsiprep preprocessing workflow takes as principal input the path of the dataset that is to be processed. The input dataset is required to be in valid BIDS formate at least one diffusion MRI series. The T1w image and the DWI may be in separate BIDS <session> folders for a given subject. We highly recommend that you validate your dataset with the free, online BIDS Validator.

The exact command to run qsiprep depends on the Installation method. The common parts of the command are similar to the BIDS-Apps definition.

Example:

qsiprep data/bids_root/ out/ participant -w work/

Command-Line Arguments

QSIPrep v0.23.0: q-Space Image Preprocessing workflows

usage: qsiprep [-h] [--skip_bids_validation]
               [--participant-label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
               [--bids-filter-file FILE] [--bids-database-dir PATH]
               [--nprocs NPROCS] [--omp-nthreads OMP_NTHREADS]
               [--mem MEMORY_MB] [--low-mem] [--use-plugin FILE] [--sloppy]
               [--anat-only] [--dwi-only] [--boilerplate-only]
               [--reports-only]
               [--ignore {fieldmaps,sbref,t2w,flair,fmap-jacobian} [{fieldmaps,sbref,t2w,flair,fmap-jacobian} ...]]
               [--infant] [--longitudinal]
               [--skip-anat-based-spatial-normalization]
               [--anat-modality {T1w,T2w,none}] [--b0-threshold B0_THRESHOLD]
               [--dwi_denoise_window DWI_DENOISE_WINDOW]
               [--denoise-method {dwidenoise,patch2self,none}]
               [--unringing-method {none,mrdegibbs,rpg}] [--dwi-no-biascorr]
               [--b1-biascorrect-stage {final,none,legacy}]
               [--no-b0-harmonization] [--denoise-after-combining]
               [--separate_all_dwis]
               [--distortion-group-merge {concat,average,none}]
               [--anatomical-template {MNI152NLin2009cAsym}]
               --output-resolution OUTPUT_RESOLUTION
               [--b0-to-t1w-transform {Rigid,Affine}]
               [--intramodal-template-iters INTRAMODAL_TEMPLATE_ITERS]
               [--intramodal-template-transform {Rigid,Affine,BSplineSyN,SyN}]
               [--fs-license-file PATH]
               [--b0-motion-corr-to {iterative,first}]
               [--hmc-transform {Affine,Rigid}]
               [--hmc_model {none,3dSHORE,eddy,tensor}]
               [--eddy-config EDDY_CONFIG] [--shoreline_iters SHORELINE_ITERS]
               [--pepolar-method {TOPUP,DRBUDDI,TOPUP+DRBUDDI}]
               [--fmap-bspline] [--fmap-no-demean]
               [--use-syn-sdc [{warn,error}]] [--force-syn] [--version] [-v]
               [-w WORK_DIR] [--resource-monitor] [--config-file FILE]
               [--write-graph] [--stop-on-first-crash] [--notrack]
               [--debug {fieldmaps,pdb,all} [{fieldmaps,pdb,all} ...]]
               bids_dir output_dir {participant}

Positional Arguments

bids_dir

The root folder of a BIDS valid dataset (sub-XXXXX folders should be found at the top level in this folder).

output_dir

The output path for the outcomes of preprocessing and visual reports

analysis_level

Possible choices: participant

Processing stage to be run, only “participant” in the case of QSIPrep (for now).

Options for filtering BIDS queries

--skip_bids_validation, --skip-bids-validation

Assume the input dataset is BIDS compliant and skip the validation

--participant-label, --participant_label

A space delimited list of participant identifiers or a single identifier (the sub- prefix can be removed)

--bids-filter-file

A JSON file describing custom BIDS input filters using PyBIDS. For further details, please check out https://fmriprep.readthedocs.io/en/0.23.0/faq.html#how-do-I-select-only-certain-files-to-be-input-to-fMRIPrep

--bids-database-dir

Path to a PyBIDS database folder, for faster indexing (especially useful for large datasets). Will be created if not present.

Options to handle performance

--nprocs, --nthreads, --n_cpus, --n-cpus

Maximum number of threads across all processes

--omp-nthreads

Maximum number of threads per-process

--mem, --mem_mb, --mem-mb

Upper bound memory limit for QSIPrep processes

--low-mem

Attempt to reduce memory usage (will increase disk usage in working directory)

--use-plugin, --nipype-plugin-file

Nipype plugin configuration file

--sloppy

Use low-quality tools for speed - TESTING ONLY

Options for performing only a subset of the workflow

--anat-only

Run anatomical workflows only

--dwi-only

ignore anatomical (T1w/T2w) data and process DWIs only

--boilerplate-only, --boilerplate_only, --boilerplate

Generate boilerplate only

--reports-only

Only generate reports, don’t run workflows. This will only rerun report aggregation, not reportlet generation for specific nodes.

Workflow configuration

--ignore

Possible choices: fieldmaps, sbref, t2w, flair, fmap-jacobian

Ignore selected aspects of the input dataset to disable corresponding parts of the workflow (a space delimited list)

--infant

configure pipelines to process infant brains

--longitudinal

Treat dataset as longitudinal - may increase runtime

--skip-anat-based-spatial-normalization

skip running the anat-based normalization to template space. Default is to run the normalization.

--anat-modality, --anat_modality

Possible choices: T1w, T2w, none

Modality to use as the anatomical reference. Images of this contrast will be skull stripped and segmented for use in the visual reports. If –infant, T2w is forced.

--b0-threshold, --b0_threshold

any value in the .bval file less than this will be considered a b=0 image. Current default threshold = 100; this threshold can be lowered or increased. Note, setting this too high can result in inaccurate results.

--dwi_denoise_window, --dwi-denoise-window

window size in voxels for image-based denoising, integer or “auto”.If “auto”, 5 will be used for dwidenoise and auto-configured for patch2self based on the number of b>0 images.

--denoise-method, --denoise_method

Possible choices: dwidenoise, patch2self, none

Image-based denoising method. Either “dwidenoise” (MRtrix), “patch2self” (DIPY) or none. (default: dwidenoise)

--unringing-method, --unringing_method

Possible choices: none, mrdegibbs, rpg

Method for Gibbs-ringing removal.
  • none: no action

  • mrdegibbs: use mrdegibbs from mrtrix3

  • rpg: Gibbs from TORTOISE, suggested for partial Fourier acquisitions (default: none).

--dwi-no-biascorr, --dwi_no_biascorr

DEPRECATED: see –b1-biascorrect-stage

--b1-biascorrect-stage, --b1_biascorrect_stage

Possible choices: final, none, legacy

Which stage to apply B1 bias correction. The default ‘final’ will apply it after all the data has been resampled to its final space. ‘none’ will skip B1 bias correction and ‘legacy’ will behave consistent with qsiprep < 0.17.

--no-b0-harmonization, --no_b0_harmonization

skip re-scaling dwi scans to have matching b=0 intensities

--denoise-after-combining, --denoise_after_combining

run dwidenoise after combining dwis, but before motion correction

--separate_all_dwis, --separate-all-dwis

don’t attempt to combine dwis from multiple runs. Each will be processed separately.

--distortion-group-merge, --distortion_group_merge

Possible choices: concat, average, none

How to combine images across distorted groups.
  • concatenate: append images in the 4th dimension

  • average: if a whole sequence was duplicated in both PE

    directions, average the corrected images of the same q-space coordinate

  • none: Default. Keep distorted groups separate

--anatomical-template

Possible choices: MNI152NLin2009cAsym

volume template space (default: MNI152NLin2009cAsym)

--output-resolution, --output_resolution

the isotropic voxel size in mm the data will be resampled to after preprocessing. If set to a lower value than the original voxel size, your data will be upsampled using BSpline interpolation.

Options for dwi-to-Anatomical coregistration

--b0-to-t1w-transform, --b0_to_t1w_transform

Possible choices: Rigid, Affine

Degrees of freedom when registering b0 to anatomical images. 6 degrees (rotation and translation) are used by default.

--intramodal-template-iters, --intramodal_template_iters

Number of iterations for finding the midpoint image from the b0 templates from all groups. Has no effect if there is only one group. If 0, all b0 templates are directly registered to the t1w image.

--intramodal-template-transform, --intramodal_template_transform

Possible choices: Rigid, Affine, BSplineSyN, SyN

Transformation used for building the intramodal template.

Specific options for FreeSurfer preprocessing

--fs-license-file, --fs_license_file

Path to FreeSurfer license key file. Get it (for free) by registering at https://surfer.nmr.mgh.harvard.edu/registration.html

Specific options for motion correction and coregistration

--b0-motion-corr-to, --bo_motion_corr_to

Possible choices: iterative, first

align to the “first” b0 volume or do an “iterative” registration of all b0 images to their midpoint image (default: iterative)

--hmc-transform, --hmc_transform

Possible choices: Affine, Rigid

transformation to be optimized during head motion correction (default: affine)

--hmc_model, --hmc-model

Possible choices: none, 3dSHORE, eddy, tensor

model used to generate target images for hmc. If “none” the non-b0 images will be warped using the same transform as their nearest b0 image. If “3dSHORE”, SHORELine will be used. if “tensor”, SHORELine iterations with a tensor model will be used

--eddy-config, --eddy_config

path to a json file with settings for the call to eddy. If no json is specified, a default one will be used. The current default json can be found here: https://github.com/PennLINC/qsiprep/blob/master/qsiprep/data/eddy_params.json

--shoreline_iters, --shoreline-iters

number of SHORELine iterations. (default: 2)

Specific options for handling fieldmaps

--pepolar-method, --pepolar_method

Possible choices: TOPUP, DRBUDDI, TOPUP+DRBUDDI

select which SDC method to use for PEPOLAR fieldmaps (default: TOPUP)

--fmap-bspline

Fit a B-Spline field using least-squares (experimental)

--fmap-no-demean

Do not remove median (within mask) from fieldmap

Specific options for SyN distortion correction

--use-syn-sdc

Possible choices: warn, error

Use fieldmap-less distortion correction based on anatomical image; if unable, error (default) or warn based on optional argument.

--force-syn

EXPERIMENTAL/TEMPORARY: Use SyN correction in addition to fieldmap correction, if available

Other options

--version

show program’s version number and exit

-v, --verbose

Increases log verbosity for each occurrence, debug level is -vvv

-w, --work-dir

Path where intermediate results should be stored

--resource-monitor

Enable Nipype’s resource monitoring to keep track of memory and CPU usage

--config-file

Use pre-generated configuration file. Values in file will be overridden by command-line arguments.

--write-graph

Write workflow graph.

--stop-on-first-crash

Force stopping on first crash, even if a work directory was specified.

--notrack

Opt-out of sending tracking information of this run to the QSIPrep developers. This information helps to improve QSIPrep and provides an indicator of real world usage crucial for obtaining funding.

--debug

Possible choices: fieldmaps, pdb, all

Debug mode(s) to enable. ‘all’ is alias for all available modes.

Note on using CUDA

The CUDA runtime version 9.1 is included in the QSIPrep docker image. The CUDA version of eddy is dramatically faster than the openmp version. Information on running Docker with CUDA enabled can be found on dockerhub. If running with singularity, the call to singularity should include --nv. To enable CUDA, see Configuring eddy.

Debugging

Logs and crashfiles are outputted into the <output dir>/qsiprep/sub-<participant_label>/log directory. Information on how to customize and understand these files can be found on the nipype debugging page.

CUDA Support

As of version 0.6.7 CUDA version 9.1 is supported in the QSIPrep container! To run locally using docker you will need the nvidia container runtime installed for Docker version 19.0.3 or higher. Singularity images will run with CUDA 9.1 with the -nv flag.