Skip to main content

Efficiently index large-scale BIDS datasets and derivatives

Project description

bids2table

Build Docs codecov Code style: black MIT License

bids2table is a library for efficiently indexing and querying large-scale BIDS neuroimaging datasets and derivatives. It aims to improve upon the efficiency of PyBIDS by leveraging modern data science tools.

bids2table represents a BIDS dataset index as a single table with columns for BIDS entities and file metadata. The index is constructed using Arrow and stored in Parquet format, a binary tabular file format optimized for efficient storage and retrieval.

Installation

A pre-release version of bids2table can be installed with

pip install bids2table

The latest development version can be installed with

pip install git+https://github.com/childmindresearch/bids2table.git

Documentation

Our documentation is here.

Example

import pandas as pd

from bids2table import bids2table

# Load in memory as pandas dataframe
df = bids2table("/path/to/dataset")

# Load in parallel and stream to disk as a Parquet dataset
df = bids2table("/path/to/dataset", persistent=True, workers=8)

See here for a more complete example.

Performance

bids2table significantly outperforms both PyBIDS and ancpBIDS in terms of indexing run time, index size on disk, and query run time.

Indexing performance

Indexing run time and index size on disk for the NKI Rockland Sample dataset. See the indexing benchmark for more details.

Index Num workers Run time (s) Index size (MB)
PyBIDS 1 1618 448
ancpBIDS 1 465 --
bids2table 1 402 4.02
bids2table 8 53.2 3.84
bids2table 64 10.7 4.82

Query performance

Query run times for the Chinese Color Nest Project dataset. See the query benchmark for more details.

Index Get subjects (ms) Get BOLD (ms) Query metadata (ms) Get morning scans (ms)
PyBIDS 1350 12.3 6.53 34.3
ancpBIDS 30.6 19.2 -- --
bids2table 0.046 0.346 0.312 0.352

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bids2table-0.1.0.tar.gz (180.4 kB view hashes)

Uploaded Source

Built Distribution

bids2table-0.1.0-py3-none-any.whl (23.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page