BIDS

Handle BIDS specific operations

exception heudiconv.bids.BIDSError
heudiconv.bids.add_rows_to_scans_keys_file(fn, newrows)

Add new rows to file fn for scans key filename and generate accompanying json descriptor to make BIDS validator happy.

fn: filename newrows: extra rows to add

dict fn: [acquisition time, referring physician, random string]
heudiconv.bids.convert_sid_bids(subject_id)

Strips any non-BIDS compliant characters within subject_id

subject_id : string

sid : string
New subject ID
subject_id : string
Original subject ID
heudiconv.bids.find_subj_ses(f_name)

Given a path to the bids formatted filename parse out subject/session

heudiconv.bids.get_formatted_scans_key_row(dcm_fn)

item

row: list
[ISO acquisition time, performing physician name, random string]
heudiconv.bids.maybe_na(val)

Return ‘n/a’ if non-None value represented as str is not empty

Primarily for the consistent use of lower case ‘n/a’ so ‘N/A’ and ‘NA’ are also treated as ‘n/a’

heudiconv.bids.populate_aggregated_jsons(path)

Aggregate across the entire BIDS dataset .json’s into top level .json’s

Top level .json files would contain only the fields which are common to all subject[/session]/type/*_modality.json’s.

ATM aggregating only for *_task*_bold.json files. Only the task- and OPTIONAL _acq- field is retained within the aggregated filename. The other BIDS _key-value pairs are “aggregated over”.

path: str
Path to the top of the BIDS dataset
heudiconv.bids.populate_bids_templates(path, defaults={})

Premake BIDS text files with templates

heudiconv.bids.save_scans_key(item, bids_files)

item: bids_files: str or list

heudiconv.bids.treat_age(age)

Age might encounter ‘Y’ suffix or be a float

heudiconv.bids.tuneup_bids_json_files(json_files)

Given a list of BIDS .json files, e.g.