Brain Image Library API
Project description
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-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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brainimagelibrary-0.0.20.tar.gz.
File metadata
- Download URL: brainimagelibrary-0.0.20.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36929efeaffa20c9c5e2f0db17ecf6e351873c954819c4597a4d16fe60cfea9e
|
|
| MD5 |
66f51d9382c4a53b1d9210c5f77ef221
|
|
| BLAKE2b-256 |
504c47f7f5287f2b37dd32645116c54c08a4c7d1d8cf3767db5e22a4b64332a3
|
File details
Details for the file brainimagelibrary-0.0.20-py3-none-any.whl.
File metadata
- Download URL: brainimagelibrary-0.0.20-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ebaa53b97d74bfc5d36d395b1d1325e967be1036d4c5dde9576e7ceed58e48f
|
|
| MD5 |
f2b66cf38fcdc9e55491c9c543d80878
|
|
| BLAKE2b-256 |
efe86f514f7cd5f40d81e435d64b4b29ce5b13695814eaaa76548e0e5b64ffe3
|