bids.layout.index.BIDSLayoutIndexer

class BIDSLayoutIndexer(validate=False, ignore=None, force_index=None, index_metadata=True, config_filename='layout_config.json', **filters)[source]

Indexer class for BIDSLayout.

Parameters:
  • validate (bool, optional) – If True, all files are checked for BIDS compliance when first indexed, and non-compliant files are ignored. This provides a convenient way to restrict file indexing to only those files defined in the “core” BIDS spec, as setting validate=True will lead noncompliant files like sub-01/nonbidsfile.txt to be ignored.

  • ignore (str or SRE_Pattern or list) – Path(s) to exclude from indexing. Each path is either a string or a SRE_Pattern object (i.e., compiled regular expression). If a string is passed, it must be either an absolute path, or be relative to the BIDS project root. If an SRE_Pattern is passed, the contained regular expression will be matched against the full (absolute) path of all files and directories. By default, indexing ignores all files in ‘code/’, ‘stimuli/’, ‘sourcedata/’, ‘models/’, and any hidden files/dirs beginning with ‘.’ at root level.

  • force_index (str or SRE_Pattern or list) – Path(s) to forcibly index in the BIDSLayout, even if they would otherwise fail validation. See the documentation for the ignore argument for input format details. Note that paths in force_index takes precedence over those in ignore (i.e., if a file matches both ignore and force_index, it will be indexed). Note: NEVER include ‘derivatives’ here; use the derivatives argument (or bids.layout.BIDSLayout.add_derivatives) for that.

  • index_metadata (bool) – If True, all metadata files are indexed. If False, metadata will not be available (but indexing will be faster).

  • config_filename (str) – Optional name of filename within directories that contains configuration information.

  • **filters – keyword arguments passed to the .get() method of a bids.layout.BIDSLayout object. These keyword arguments define what files get selected for metadata indexing.

Attributes:
session

Methods

__call__(layout)

Call self as a function.

__init__(validate=False, ignore=None, force_index=None, index_metadata=True, config_filename='layout_config.json', **filters)[source]

Methods

__init__([validate, ignore, force_index, ...])

Attributes

session