fitlins.utils.bids module

Utilities to handle BIDS inputs

Fetch some test data

>>> import os
>>> from niworkflows import data
>>> data_root = data.get_bids_examples(variant='BIDS-examples-1-enh-ds054')
>>> os.chdir(data_root)
exception fitlins.utils.bids.BIDSError(message, bids_root)[source]

Bases: ValueError

exception fitlins.utils.bids.BIDSWarning[source]

Bases: RuntimeWarning

fitlins.utils.bids.collect_participants(layout, participant_label=None, strict=False)[source]

List the participants under the BIDS root and checks that participants designated with the participant_label argument exist in that folder.

Returns the list of participants to be finally processed.

Requesting all subjects in a BIDS directory root:

>>> collect_participants(layout)
['01', '02', '03', '04', '05', '06', '07', '08', '09', '10']

Requesting two subjects, given their IDs:

>>> collect_participants(layout, participant_label=['02', '04'])
['02', '04']

Requesting two subjects, given their IDs (works with ‘sub-’ prefixes):

>>> collect_participants(layout, participant_label=['sub-02', 'sub-04'])
['02', '04']

Requesting two subjects, but one does not exist:

>>> collect_participants(layout, participant_label=['02', '14'])
['02']
>>> collect_participants(layout, participant_label=['02', '14'],
...                      strict=True)  
Traceback (most recent call last):
fmriprep.utils.bids.BIDSError:
...
fitlins.utils.bids.load_all_specs(all_specs, specs, node, **filters)[source]
fitlins.utils.bids.write_derivative_description(bids_dir, deriv_dir, args)[source]