PyBIDS is a Python library that provides an interface for interacting with datasets organized according to the Brain Imaging Data Structure (BIDS) specification. It allows users to query, manage, and extract information from BIDS datasets, supporting local and cloud-based paths. The current version is 0.22.0, and the library maintains an active release cadence with minor feature releases every few months and frequent bug-fix updates.
pip install pybidsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `BIDSLayout` for a BIDS-compliant dataset and query for specific files using entity key-value pairs. It includes creating a minimal dummy BIDS structure to make the example runnable without an existing dataset.
Upgrade your Python environment to 3.10 or newer. Ensure all scientific computing dependencies (NumPy, SciPy, NiBabel, Pandas) meet or exceed the specified minimum versions (e.g., NumPy >=1.24, Pandas >=2.0).
To control indexing behavior, create an explicit `BIDSLayoutIndexer` instance and pass it to the `BIDSLayout` constructor. Ensure all file paths are handled as absolute paths, as disabling this mode is no longer supported.
Be aware that while `pybids` can index these files, BIDS validation tools might flag them as invalid until the BIDS specification and `bidsschematools` are updated to reflect this change.
Upgrade to PyBIDS 0.16.4 or later to ensure boolean metadata fields are correctly interpreted.
This functionality was removed. All paths are now absolute. For indexer configuration, use `BIDSLayoutIndexer` when initializing `BIDSLayout`.
The main `BIDSLayout` class is available directly under the top-level `bids` package. Use `from bids import BIDSLayout`.
Inspect the output of the validator for specific errors. Rectify issues in your BIDS dataset. Alternatively, initialize `BIDSLayout(..., validate=False)` to skip validation, but be aware this may lead to issues if the data is severely malformed.
Ensure your custom entity is correctly defined in a custom BIDS pattern file and loaded into the `BIDSLayout` instance upon initialization (e.g., `BIDSLayout(..., config=['my_custom_config.json'])`).