bids_util

Functions

get_candidates(source_dir, tsv_file_dict)

get_merged_sidecar(root_path, tsv_file)

get_schema_from_description(root_path)

group_by_suffix(file_list)

Group files by suffix.

matches_criteria(json_file_dict, tsv_file_dict)

parse_bids_filename(file_path)

Split a filename into BIDS-relevant components.

update_entity(name_dict, entity)

Update the dictionary with a new entity.

walk_back(root_path, file_path)

get_candidates(source_dir, tsv_file_dict)[source]
get_merged_sidecar(root_path, tsv_file)[source]
get_schema_from_description(root_path)[source]
group_by_suffix(file_list)[source]

Group files by suffix.

Parameters:

file_list (list) – List of file paths.

Returns:

Dictionary with suffixes as keys and file lists as values.

Return type:

dict

matches_criteria(json_file_dict, tsv_file_dict)[source]
parse_bids_filename(file_path)[source]

Split a filename into BIDS-relevant components.

Parameters:

file_path (str) – Path to be parsed.

Returns:

Dictionary with keys ‘basename’, ‘suffix’, ‘prefix’, ‘ext’, ‘bad’, and ‘entities’.

Return type:

dict

Notes

  • Splits into BIDS suffix, extension, and a dictionary of entity name-value pairs.

update_entity(name_dict, entity)[source]

Update the dictionary with a new entity.

Parameters:
  • name_dict (dict) – Dictionary of entities.

  • entity (str) – Entity to be added.

walk_back(root_path, file_path)[source]