interfaces.bids_utils¶
BIDSDataGrabber¶
BIDS datagrabber module that wraps around pybids to allow arbitrary querying of BIDS datasets.
Examples¶
By default, the BIDSDataGrabber fetches anatomical and functional images from a project, and makes BIDS entities (e.g. subject) available for filtering outputs.
>>> bg = BIDSDataGrabber()
>>> bg.inputs.base_dir = 'ds005/'
>>> bg.inputs.subject = '01'
>>> results = bg.run()
Dynamically created, user-defined output fields can also be defined to return different types of outputs from the same project. All outputs are filtered on common entities, which can be explicitly defined as infields.
>>> bg = BIDSDataGrabber(infields = ['subject'], outfields = ['dwi'])
>>> bg.inputs.base_dir = 'ds005/'
>>> bg.inputs.subject = '01'
>>> bg.inputs.output_query['dwi'] = dict(modality='dwi')
>>> results = bg.run()
Inputs:
[Mandatory]
base_dir: (an existing directory name)
Path to BIDS Directory.
[Optional]
output_query: (a dictionary with keys which are a unicode string and
with values which are a dictionary with keys which are any value
and with values which are any value)
Queries for outfield outputs
raise_on_empty: (a boolean, nipype default value: True)
Generate exception if list is empty for a given field
return_type: ('file' or 'namedtuple', nipype default value: file)
Outputs:
None