qsiprep.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 qsiprep.utils.bids.BIDSError(message, bids_root)[source]
Bases:
ValueError
- exception qsiprep.utils.bids.BIDSWarning[source]
Bases:
RuntimeWarning
- qsiprep.utils.bids.collect_data(bids_dir, participant_label, filters=None, bids_validate=True)[source]
Use pybids to retrieve the input data for a given participant.
- qsiprep.utils.bids.collect_participants(bids_dir, participant_label=None, strict=False, bids_validate=True)[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('ds114') ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10']
Requesting two subjects, given their IDs:
>>> collect_participants('ds114', participant_label=['02', '04']) ['02', '04']
Requesting two subjects, given their IDs (works with ‘sub-’ prefixes):
>>> collect_participants('ds114', participant_label=['sub-02', 'sub-04']) ['02', '04']
Requesting two subjects, but one does not exist:
>>> collect_participants('ds114', participant_label=['02', '14']) ['02']
>>> collect_participants('ds114', participant_label=['02', '14'], ... strict=True) Traceback (most recent call last): qsiprep.utils.bids.BIDSError: ...