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.

legacybool, default=True

Whether to return a dictionary that uses BIDS terms (False) or the legacy content for the output (True). False will become the default in version >= 0.13.0.

Added in version 0.12.0.

Returns:
referencedict

Returns a dictionary with all key-value pairs in the file name parsed and other useful fields.

Added in version 0.13.0dev.

The dictionary will contain:

  • 'file_path',

  • 'file_basename',

  • 'extension',

  • 'suffix'

  • and 'entities'.

See the documentation on typical bids filename for more information.