Configuration Loading & Validation
The YAML configuration file tells nf-bids which BIDS suffixes to collect and how to group them for channel emission.
Configuration file structure
# Which BIDS entities define the outer grouping key (one item per channel emission)
loop_over:
- subject
- session
# Each top-level key (other than loop_over) names a "config key"
# that becomes a top-level field in the flat output map.
T1w:
plain_set: {} # no extra options needed for a simple plain set
dwi_ap:
named_set:
ap: {direction: dir-AP} # entity pattern for the AP direction
pa: {direction: dir-PA}
required: [ap, pa] # both directions must exist or the group is dropped
additional_extensions: [.bval, .bvec]
suffix_maps_to: dwi # the BIDS suffix is 'dwi', not 'dwi_ap'
mese:
sequential_set:
by_entity: echo # vary over the 'echo' entity
additional_extensions: [.json]
mpm:
mixed_set:
named_dimension: acquisition
sequential_dimension: echo
named_groups:
MTw: {acquisition: acq-MTw}
PDw: {acquisition: acq-PDw}
T1w: {acquisition: acq-T1w}
required: [MTw, PDw, T1w]
Global rules
-
loop_overis the only global top-level key. -
Every other top-level key is a config key (for example
T1w,dwi_ap,mese). -
The top-level key
metais reserved and cannot be used as a config key. -
Each config key must define exactly one set type:
plain_set,named_set,sequential_set, ormixed_set. -
loop_overmust be a list. -
If omitted,
loop_overdefaults to[subject, session, run, task].
Global options (per config key)
These options can be used alongside any set type unless stated otherwise.
| Option | Type | Description |
|---|---|---|
|
|
Extra file extensions to collect alongside |
|
|
Additional config keys to copy into the same emitted item. |
|
|
Entity names ignored during file matching for this config key. |
|
|
Real BIDS suffix to match when it differs from the config key name. |
|
|
Named groups that must be present (used with |
Set types
| Set type | When to use |
|---|---|
|
One file per suffix per grouping key, no discriminating entity (e.g. T1w, FLAIR). |
|
Multiple named variants of the same suffix distinguished by an entity value
(e.g. DWI AP/PA encoded by |
|
An ordered series that varies over a single entity (e.g. multi-echo MESE images). |
|
Named groups each containing their own sequential series (e.g. MPM protocol). |
plain_set
Structure:
T1w:
plain_set: {}
additional_extensions: [.json]
suffix_maps_to: T1w
include_cross_modal: [brainmask]
exclude_entities: [run]
Specific rules:
-
plain_sethas no required inner fields. -
Use it when one group should contain a single file set per
loop_overkey.
named_set
Structure:
dwi_ap:
named_set:
ap: {direction: dir-AP}
pa: {direction: dir-PA}
required: [ap, pa]
additional_extensions: [.bval, .bvec]
suffix_maps_to: dwi
Specific options and rules:
-
named_setmust define at least one named group. -
Each named group value must be a map of entity constraints.
-
requiredentries must match group names declared innamed_set.
sequential_set
Structure:
mese:
sequential_set:
by_entity: echo
additional_extensions: [.json]
bold:
sequential_set:
by_entities: [run, echo]
order: hierarchical
Specific options:
| Option | Type | Description |
|---|---|---|
|
|
Sequence over a single entity (for example |
|
|
Sequence over multiple entities. |
|
|
Ordering mode for |
Specific rules:
-
Exactly one of
by_entityorby_entitiesmust be set. -
by_entitiesmust be a non-empty list. -
ordermust beflatorhierarchical. -
orderis only meaningful withby_entities.
mixed_set
Structure:
mpm:
mixed_set:
named_dimension: acquisition
sequential_dimension: echo
named_groups:
MTw: {acquisition: acq-MTw}
PDw: {acquisition: acq-PDw}
T1w: {acquisition: acq-T1w}
required: [MTw, PDw, T1w]
Specific options and rules:
-
Required fields inside
mixed_set:named_dimension,sequential_dimension,named_groups. -
named_groupsvalues must be entity-pattern maps. -
requiredfollows the same behavior asnamed_set.