Skip to main content

Load and plot Allen Mouse Brain Connectivity data

Project description

Brain Street View bsv

Load and plot Allen Connectivity Data (Oh et al., Nature, 2014)

Available in both MATLAB and Python.

🏁 Quick start

Python (recommended):

pip install -e .

Then open example.ipynb or run example.py. The first run downloads images from the Allen API and caches them locally. Subsequent runs load from cache.

MATLAB: See the script gettingStarted.mlx. Requires MATLAB>=2019a.

⚒️ Installation

Python

# clone and install
git clone https://github.com/Julie-Fabre/brain_street_view.git
cd brain_street_view
pip install -e .

Or with conda:

conda create -n bsv python=3.12 -y
conda activate bsv
pip install -e .

You also need the Allen CCF atlas files (not included):

  • allenCCF — annotation volumes and structure trees

MATLAB

MATLAB dependencies:

📖 Usage

Python

import bsv

# 1. Find experiments
experiment_ids = bsv.find_connectivity_experiments(['VISp', 'VISl'])

# 2. Fetch data
imgs, inj_summary, _, _ = bsv.fetch_connectivity_data(
    experiment_ids, '/path/to/cache', '',
    'injectionIntensity', False,
    allen_atlas_path='/path/to/allenCCF')

# 3. Plot projections to striatum
bsv.plot_connectivity(imgs, '/path/to/allenCCF', 'CP',
                       10, 15, 'coronal', True, 2, 'global', None,
                       'injectionIntensity')

# 4. 3D visualization
bsv.plot_connectivity_3d(inj_summary, '/path/to/allenCCF', 'CP',
                          plot_patch=True)

See example.ipynb for the full workflow including region grouping, thresholding, and CP subregion analysis.

MATLAB

% 1. Find experiments
experimentIDs = bsv.findConnectivityExperiments({'VISp', 'VISl'});

% 2. Fetch data
[experimentImgs, injectionSummary] = bsv.fetchConnectivityData(experimentIDs, ...
    saveLocation, fileName, 'injectionIntensity', false, '', allenAtlasPath);

% 3. Plot
bsv.plotConnectivity(experimentImgs, allenAtlasPath, 'CP', 10, 15, ...
    'coronal', true, 2, 'global', [], 'injectionIntensity')

See +bsv/example.m for the full MATLAB workflow.

🖼️ Gallery

  • projections from visual cortices to striatum: injection sites and striatum plotted in 3D
  • example injections in primary visual cortex (VISp)
  • example injections in antero-lateral visual cortex (VISal)
  • projections from visual cortices (VIS) to striatum (CP)

📬 Contact me

If you run into any issues or if you have any suggestions, please raise a github issue, create a pull request or email me: juliemfabre[at]gmail[dot]com.

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

brain_street_view-0.1.0.tar.gz (7.2 MB view details)

Uploaded Source

Built Distribution

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

brain_street_view-0.1.0-py3-none-any.whl (74.4 kB view details)

Uploaded Python 3

File details

Details for the file brain_street_view-0.1.0.tar.gz.

File metadata

  • Download URL: brain_street_view-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for brain_street_view-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35a7a49cb9800b8685593392e6b8fc4ed5bf55d9e8ef01b7ea9bd11e59245b6c
MD5 493291b19015bcbda7d0c994cc3925ec
BLAKE2b-256 06147dca19deeea3930f27b7a005247af79a1527f2e9d3b07acd07b847e1b33e

See more details on using hashes here.

File details

Details for the file brain_street_view-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brain_street_view-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5cf3fa355aa59306bd3f28cfb14ad12046064954bb87348aea3b48381107baa
MD5 374ff2a5fcb694389ac793e048770b40
BLAKE2b-256 d80d5ee145a803ca879f3a5fb64fdb60f28c9c3bc2431468f2140d7a1903ca81

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