Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.interfaces.bids.parse_bids_filename#

nilearn.interfaces.bids.parse_bids_filename(img_path)[source]#

Return dictionary with parsed information from file path.

Parameters
img_pathstr

Path to file from which to parse information.

Returns
referencedict

Returns a dictionary with all key-value pairs in the file name parsed and other useful fields like ‘file_path’, ‘file_basename’, ‘file_tag’, ‘file_type’ and ‘file_fields’.

The ‘file_tag’ field refers to the last part of the file under the BIDS convention that is of the form *_tag.type. Contrary to the rest of the file name it is not a key-value pair. This notion should be revised in the case we are handling derivatives since so far the convention will keep the tag prepended to any fields added in the case of preprocessed files that also end with another tag. This parser will consider any tag in the middle of the file name as a key with no value and will be included in the ‘file_fields’ key.