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

from brainimagelibrary import retrieve, query

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

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

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

# By contributor affiliation
results = retrieve.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-2026 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.21.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.21-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brainimagelibrary-0.0.21.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.21.tar.gz
Algorithm Hash digest
SHA256 6c830b3c9446fb2cfdd25903ab864c5e1f337dfb69d03f5af0b9ef4f99fd57af
MD5 02d416ec425a65cc693aa6b56b32dfaf
BLAKE2b-256 f2c86cabb8cea021070fc0137f5749b92dee38de5b0c5153ca1729bacd35d810

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for brainimagelibrary-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 d3bdda5db73c63d5ab7f91d0dece55bb36152bfc3df0bfe37c2234e3d9fe0aba
MD5 282dfcd5f5cbbce2d279529851aa6f57
BLAKE2b-256 42405da852c044c89fbce1af92605aa2f02e0a2e626ca88a021872a8c11b6dd4

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