Skip to main content

Brain Image Library API

Project description

Status Issue forks Stars License

py-brain-sdk

py-brain-sdk is a Python library that simplifies interaction with the Brain Image Library (BIL), a national public resource for neuroscience research. BIL provides access to petabyte-scale brain microscopy datasets, including whole and partial brain images, neuron morphologies, connectivity data, and spatial transcriptomics. This SDK enables researchers, data scientists, and developers to programmatically query, download, and analyze BIL datasets, leveraging its APIs and integrated analysis ecosystem.

With py-brain-sdk, you can

  • Search and retrieve brain imaging datasets and metadata.
  • Query datasets by ID, directory path, contributor affiliation, or free-text search.
  • Look up DOI metadata and citation counts from DataCite, OpenCitations, Crossref, and Semantic Scholar.
  • Browse BIL collections and enumerate their constituent datasets.
  • Download specific image files or subsets of large datasets.

Installation

pip install brainimagelibrary

Quick Start

Retrieve dataset metadata

import brainimagelibrary as bil

# By BIL dataset ID
metadata = bil.retrieve.by_id(bildid="act-bag")

# By directory path
metadata = bil.retrieve.by_directory(directory="/bil/data/2019/02/13/H19.28.012.MITU.01.05")

# Full-text search
results = bil.metadata.query("mouse cortex")

# By contributor affiliation
results = bil.metadata.by_affiliation("Carnegie Mellon University")

List all dataset IDs

import brainimagelibrary as bil

bildids = bil.get_all_bildids()
print(f"Total datasets: {len(bildids)}")

DOI and citation lookup

from brainimagelibrary import dois

# Check if a dataset has a registered DOI
dois.dataset.exists(bildid="act-bag")

# Get DataCite metadata
metadata = dois.dataset.get(bildid="act-bag")

# Get citation counts from multiple sources
citations = dois.dataset.get_number_of_citations(bildid="act-bag")
# {‘datacite’: 2, ‘opencitations’: 1, ‘crossref’: 0, ‘semanticscholar’: 3}

# Get full citation records
records = dois.dataset.get_datacite_citations(bildid="act-bag")

Collection operations

from brainimagelibrary import dois

# List all datasets in a collection
datasets = dois.collection.get_datasets(bildid="act-bag")
for entry in datasets:
    print(entry["bildid"], entry["url"])

Copyright © 2020-2025 Pittsburgh Supercomputing Center. All Rights Reserved.

The Biomedical Applications Group at the Pittsburgh Supercomputing Center in the Mellon College of Science at Carnegie Mellon University.

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

brainimagelibrary-0.0.19.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brainimagelibrary-0.0.19-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file brainimagelibrary-0.0.19.tar.gz.

File metadata

  • Download URL: brainimagelibrary-0.0.19.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for brainimagelibrary-0.0.19.tar.gz
Algorithm Hash digest
SHA256 7cabca11378d51efb5d12b3335b5c864b3d5353021a73cbbbd43d803d7b5cf7c
MD5 6173ff975fd59c384dc4b6bd2c6e8ffa
BLAKE2b-256 6fdccaaa06d849af49030f43d2d1670437e7da77e30ee37bc928c4358c326e19

See more details on using hashes here.

File details

Details for the file brainimagelibrary-0.0.19-py3-none-any.whl.

File metadata

File hashes

Hashes for brainimagelibrary-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 73fde42bd3ef633ec82550e6af54f47308a7cec4bad448f2f9fc68765e77182b
MD5 c9766be09b820cdb3b85b9287d29e377
BLAKE2b-256 930fce927b4a3f065df9a9e4e1d54933b3b9b8460772f295b56dec1e77b50727

See more details on using hashes here.

Supported by

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