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, legacy=True)[source]¶
Return dictionary with parsed information from file path.
- Parameters:
- Returns:
- reference
dict
Returns a dictionary with all key-value pairs in the file name parsed and other useful fields.
The dictionary will contain
'file_path'
,'file_basename'
.If
legacy
is set toTrue
, the dictionary will also contain ‘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.If
legacy
is set toFalse
, the dictionary will instead contain'extension'
,'suffix'
and'entities'
. (See the documentation on typical bids filename for more information).
- reference