bidshandler.Scan

class bidshandler.Scan(fpath, session, **scan_params)[source]

Bases: bidshandler.querymixin.QueryMixin

Scan-level object

Parameters:
  • fpath (str) – The path to the raw scan file.
  • session (Instance of bidshandler.Session) – Parent Session object containing this Scan.
  • scan_params (dict, optional) – A dictionary containing any number of other scan parameters specified by scans.tsv.
__init__(fpath, session, **scan_params)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(fpath, session, **scan_params) Initialize self.
contained_files() Get the list of contained files.
delete() Delete all the scans’ files.
query(obj, token, condition, value) Query the BIDS object and return the appropriate data.

Attributes

bids_tree Parent bidshandler.BIDSTree object.
channels_tsv Path to the associated channels.tsv file if there is one.
coordsystem_json Path to the associated coordsystem.json file if there is one.
emptyroom Associated emptyroom Scan.
events_tsv Absolute path to the associated events.tsv file.
path Path of folder containing Scan.
project Parent bidshandler.Project object.
projects
raw_file Path of associated raw file.
raw_file_relative Path of associated raw file relative to parent Session.
scan_type Type of Scan.
scans
sessions
sidecar Path of associated sidecar file if there is one.
subject Parent bidshandler.Subject object.
subjects
__contains__(other)
bids_tree

Parent bidshandler.BIDSTree object.

channels_tsv

Path to the associated channels.tsv file if there is one.

contained_files()[source]

Get the list of contained files.

Returns:file_list – List with paths to all contained files relating to the BIDS structure.
Return type:list
coordsystem_json

Path to the associated coordsystem.json file if there is one.

delete()[source]

Delete all the scans’ files.

emptyroom

Associated emptyroom Scan.

Returns:Associated emptyroom Scan object.
Return type:bidshandler.Scan

Note

Only for MEG scans.

events_tsv

Absolute path to the associated events.tsv file.

path

Path of folder containing Scan.

project

Parent bidshandler.Project object.

projects
query(obj, token, condition, value)

Query the BIDS object and return the appropriate data.

Parameters:
  • obj (str) – The object type that should be returned. This can be one of (‘project’, ‘subject’, ‘session’, ‘scan’)
  • token (str) –

    The key to query for. This can be a value from the following list:

    • task: Corresponds to the task key in the BIDS filename.
    • acquisition or acq: Corresponds to the acq key in the BIDS filename.
    • run: Corresponds to the run key in the BIDS filename.
    • proc: Corresponds to the proc key in the BIDS filename.
    • age: Corresponds to the age of the participant. [Only available for obj=’subject’]
    • sex: Corresponds to the gender of the participant. [Only available for obj=’subject’]
    • group: Corresponds to the group of the participant. [Only available for obj=’subject’]
    • rec_date: Corresponds to the time and date of the recording. The value can either be formatted like “%Y-%m-%d” (ie. YYYY-MM-DD) to specify a single day, or it can be specified to the second by formatting it using the format string “%Y-%m-%dT%H:%M:%S” (ie. YYYY-MM-DDTHH:mm:ss).
    • subjects: Corresponds to the number of subjects contained. [Only available for obj=’project’]
    • sessions: Corresponds to the number of sessions contained. [Only available for obj=’project’ or ‘subject’]
    • scans: Corresponds to the number of scans contained. [Only available for obj=’project’, ‘subject’ or ‘session’]
    • Any other token will be considered to be a key in the sidecar.json file.
  • condition (str) – One of (‘<’, ‘<=’, ‘=’, ‘!=’, ‘!!=’ (none equal), ‘=>’, ‘>’). Used to perform comaprisons between the value provided and the values the data have. The ‘!!=’ operator here is used to distinguish between the case of when you want to determine if something contains something that isn’t the value you specify, and whether something doesn’t contain the value specified. This operator is currently only supported for the tokens ‘task’, ‘acquisition’/’acq’, `’run’ and ‘proc’.
  • value (str | int | float) – The value the token has (or the value to compare using the condition argument). The value provided must match exactly if the equality operator is used, and must have a type appropriate for comparison if an inequality operator is used. Currently regex is not supported, but this may come in the future.
Returns:

return_data – List of objects that satisfy the provided query conditions.

Return type:

bidshandler.querylist.QueryList

raw_file

Path of associated raw file.

raw_file_relative

Path of associated raw file relative to parent Session.

scan_type

Type of Scan.

This will be the name of the folder the Scan resides in. Eg. meg for MEG data, func for fMRI data.

scans
sessions
sidecar

Path of associated sidecar file if there is one.

subject

Parent bidshandler.Subject object.

subjects