The BIDS format

The NiBabies 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 format, and it must include at least one T1-weighted and one T2-weighted structural image and a BOLD series (unless using the --anat-only flag).

We highly recommend that you validate your dataset with the free, online BIDS Validator.

Participant Ages

NiBabies will attempt to automatically extract participant ages (in months) from the BIDS layout. Specifically, these two files will be checked:

Either file should include age (or if you wish to be more explicit: age_months) columns, and it is recommended to have an accompanying JSON file to further describe these fields, and explicitly state the values are in months.

The FreeSurfer license

NiBabies uses FreeSurfer tools, which require a license to run.

To obtain a FreeSurfer license, simply register for free at

FreeSurfer will search for a license key file first using the $FS_LICENSE environment variable and then in the default path to the license key file ($FREESURFER_HOME/license.txt). If $FS_LICENSE is set, the nibabies-wrapper will automatically handle setting the license within the container. Otherwise, you will need to use the --fs-license-file flag to ensure the license is available.

Example command

The exact command to run NiBabies depends on the Installation method. The common parts of the command follow the BIDS-Apps definition. Example:

$ nibabies data/bids_root/ out/ participant -w work/ --participant-label 01

Further information about BIDS and BIDS-Apps can be found at the NiPreps portal.

Command-Line Arguments

NiBabies: Preprocessing workflows for infants v24.1.0.dev35+g7b1e91d

usage: nibabies [-h] [--version] [--skip_bids_validation]
                [--participant-label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
                [-s SESSION_ID [SESSION_ID ...]] [-t TASK_ID]
                [--echo-idx ECHO_IDX] [--bids-filter-file FILE]
                [--anat-derivatives PATH] [--bids-database-dir PATH]
                [--nprocs NPROCS] [--omp-nthreads OMP_NTHREADS]
                [--mem MEMORY_GB] [--low-mem] [--use-plugin FILE]
                [--anat-only] [--boilerplate_only] [--md-only-boilerplate]
                [--error-on-aroma-warnings] [-v]
                [--ignore {fieldmaps,slicetiming,sbref,t2w,flair} [{fieldmaps,slicetiming,sbref,t2w,flair} ...]]
                [--longitudinal] [--output-spaces [OUTPUT_SPACES ...]]
                [--me-output-echos] [--bold2t1w-init {register,header}]
                [--bold2t1w-dof {6,9,12}] [--force-bbr] [--force-no-bbr]
                [--medial-surface-nan] [--project-goodvoxels]
                [--slice-time-ref SLICE_TIME_REF] [--dummy-scans DUMMY_SCANS]
                [--random-seed _RANDOM_SEED] [--use-aroma]
                [--aroma-melodic-dimensionality AROMA_MELODIC_DIM]
                [--fd-spike-threshold REGRESSORS_FD_TH]
                [--dvars-spike-threshold REGRESSORS_DVARS_TH]
                [--skull-strip-template SKULL_STRIP_TEMPLATE]
                [--skull-strip-t1w {auto,skip,force}] [--fmap-bspline]
                [--fmap-no-demean] [--use-syn-sdc] [--force-syn]
                [--fs-license-file FILE] [--fs-subjects-dir PATH]
                [--no-submm-recon] [--cifti-output [{91k,170k}] |
                --fs-no-reconall] [--output-layout {bids,legacy}]
                [-w WORK_DIR] [--clean-workdir] [--resource-monitor]
                [--reports-only] [--config-file FILE] [--write-graph]
                [--stop-on-first-crash] [--notrack]
                [--debug {compcor,registration,fieldmaps,all} [{compcor,registration,fieldmaps,all} ...]]
                [--sloppy] [--age-months AGE_MONTHS]
                [--segmentation-atlases-dir SEGMENTATION_ATLASES_DIR]
                [--fd-radius FD_RADIUS] [-d DERIVATIVES [DERIVATIVES ...]]
                [--deriv-filter-file FILE] [--force-reconall]
                [--surface-recon-method {infantfs,freesurfer,mcribs}]
                bids_dir output_dir {participant}

Positional Arguments


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


the output path for the outcomes of preprocessing and visual reports


Possible choices: participant

processing stage to be run, only “participant” in the case of NiBabies (see BIDS-Apps specification).

Named Arguments


show program’s version number and exit

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)

-s, --session-id

a space delimited list of session identifiers or a single identifier

-t, --task-id

select a specific task to be processed


select a specific echo to be processed in a multiecho series


a JSON file describing custom BIDS input filters using PyBIDS. For further details, please check out


Reuse the anatomical derivatives from another NiBabies run or calculated with an alternative processing tool (NOT RECOMMENDED).


Path to an existing PyBIDS database folder, for faster indexing (especially useful for large datasets).

Options to handle performance

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

maximum number of threads across all processes


maximum number of threads per-process

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

upper bound memory limit for NiBabies processes


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

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

nipype plugin configuration file


run anatomical workflows only


generate boilerplate only


skip generation of HTML and LaTeX formatted citation with pandoc


Raise an error if ICA_AROMA does not produce sensible output (e.g., if all the components are classified as signal or noise)

-v, --verbose

increases log verbosity for each occurence, debug level is -vvv

Default: 0

Workflow configuration


Possible choices: fieldmaps, slicetiming, sbref, t2w, flair

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

Default: []


treat dataset as longitudinal - may increase runtime


Standard and non-standard spaces to resample anatomical and functional images to. Standard spaces may be specified by the form <SPACE>[:cohort-<label>][:res-<resolution>][...], where <SPACE> is a keyword designating a spatial reference, and may be followed by optional, colon-separated parameters. Non-standard spaces imply specific orientations and sampling grids. Important to note, the res-* modifier does not define the resolution used for the spatial normalization. To generate no BOLD outputs, use this option without specifying any spatial references. For further details, please check out


Output individual echo time series with slice, motion and susceptibility correction. Useful for further Tedana processing post-NiBabies.


Possible choices: register, header

Either “register” (the default) to initialize volumes at center or “header” to use the header information when coregistering BOLD to T1w images.

Default: “register”


Possible choices: 6, 9, 12

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

Default: 6


Always use boundary-based registration (no goodness-of-fit checks)


Do not use boundary-based registration (no goodness-of-fit checks)


Replace medial wall values with NaNs on functional GIFTI files. Only performed for GIFTI files mapped to a freesurfer subject (fsaverage or fsnative).


Exclude voxels whose timeseries have locally high coefficient of variation from surface resampling. Only performed for GIFTI files mapped to a freesurfer subject (fsaverage or fsnative).


The time of the reference slice to correct BOLD values to, as a fraction acquisition time. 0 indicates the start, 0.5 the midpoint, and 1 the end of acquisition. The alias start corresponds to 0, and middle to 0.5. The default value is 0.5.


Number of non steady state volumes.


Initialize the random seed for the workflow

Specific options for running ICA_AROMA


add ICA_AROMA to your preprocessing stream


Exact or maximum number of MELODIC components to estimate (positive = exact, negative = maximum)

Default: -200

Specific options for estimating confounds


Include all components estimated in CompCor decomposition in the confounds file instead of only the components sufficient to explain 50 percent of BOLD variance in each CompCor mask


Threshold for flagging a frame as an outlier on the basis of framewise displacement

Default: 0.5


Threshold for flagging a frame as an outlier on the basis of standardised DVARS

Default: 1.5

Specific options for ANTs registrations


select a template for skull-stripping with antsBrainExtraction

Default: UNCInfant:cohort-1


do not use a random seed for skull-stripping - will ensure run-to-run replicability when used with –omp-nthreads 1 and matching –random-seed <int>


Possible choices: auto, skip, force

determiner for T1-weighted skull stripping (‘force’ ensures skull stripping, ‘skip’ ignores skull stripping, and ‘auto’ applies brain extraction based on the outcome of a heuristic to check whether the brain is already masked).

Default: “force”

Specific options for handling fieldmaps


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


do not remove median (within mask) from fieldmap

Specific options for SyN distortion correction


EXPERIMENTAL: Use fieldmap-free distortion correction


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

Specific options for FreeSurfer preprocessing


Path to FreeSurfer license key file. Get it (for free) by registering at


Path to existing FreeSurfer subjects directory to reuse. (default: OUTPUT_DIR/freesurfer)

Surface preprocessing options


disable sub-millimeter (hires) reconstruction


Possible choices: 91k, 170k

output preprocessed BOLD as a CIFTI dense timeseries. Optionally, the number of grayordinate can be specified (default is 91k, which equates to 2mm resolution)

Default: False


disable FreeSurfer surface preprocessing.

Other options


Possible choices: bids, legacy

Organization of outputs. bids (default) places NiBabies derivatives directly in the output directory, and defaults to placing FreeSurfer derivatives in <output-dir>/sourcedata/freesurfer. legacy creates derivative datasets as subdirectories of outputs.

Default: “bids”

-w, --work-dir

path where intermediate results should be stored

Default: /home/docs/checkouts/


Clears working directory of contents. Use of this flag is notrecommended when running concurrent processes of NiBabies.


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


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


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


Write workflow graph.


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


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


Possible choices: compcor, registration, fieldmaps, all

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


Use low-quality tools for speed - TESTING ONLY

NiBabies specific options


Age in months


Directory containing precalculated segmentations to use for JointLabelFusion.


Head radius in mm for framewise displacement calculation.

Default: 45

-d, --derivatives

One or more directory containing pre-computed derivatives.


A JSON file for customizing the derivatives queries.


Force traditional FreeSurfer surface reconstruction.


Possible choices: infantfs, freesurfer, mcribs

Method to use for surface reconstruction

Default: “infantfs”

More information on command-line arguments

At minimum, the following positional arguments are required.

  • bids_dir - the root folder of a BIDS valid dataset.

  • output_dir - folder to store outputs and reports.

  • level - processing stage to be run, currently can only be participant.

However, as infant brains can vastly differ depending on age, providing the following arguments is highly recommended:

  • --participant-label - participant ID

  • --session-id - session ID

  • --segmentation-atlases-dir - directory containing pre-labeled segmentations to use for Joint Label Fusion.


The segmentation directory layout should consist of one or more template directories containing:

  • A segmented and labeled NIfTI that includes Segmentation in the filename.

  • A brainmasked T1w NIfTI that includes T1w in the filename.

Using the nibabies wrapper

The wrapper will generate a Docker or Singularity command line for you, print it out for reporting purposes, and then execute it without further action needed. For installation instructions, please see Installing the nibabies-wrapper

Sample Docker usage

$ nibabies-wrapper docker /path/to/data /path/to/output participant --fs-license-file /usr/freesurfer/license.txt

RUNNING: docker run --rm -e DOCKER_VERSION_8395080871=20.10.6 -it -v /path/to/data:/data:ro \
-v /path/to/output:/out -v /usr/freesurfer/license.txt:/opt/freesurfer/license.txt:ro \
nipreps/nibabies:23.0.0 /data /out participant

Docker usage warning

When using Docker, the wrapper will default to using the same version of nibabies as the wrapper. This can be overridden by using the -i flag to specify a particular Docker image.

Sample Singularity usage

$ nibabies-wrapper singularity /path/to/data /path/to/output participant -i nibabies-23.0.0.sif --fs-license-file /usr/freesurfer/license.txt

RUNNING: singularity run --cleanenv -B /path/to/data:/data:ro \
-B /path/to/output:/out -B /usr/freesurfer/license.txt:/opt/freesurfer/license.txt:ro \
nibabies-23.0.0.sif /data /out participant

Singularity usage warning

Note that the -i flag is required when using Singularity, and should be the path to the already built Singularity image file.

The command-line interface of the nibabies wrapper