Load and plot Allen Mouse Brain Connectivity data
Project description
Brain Street View 
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
- Clone the repository and the dependencies below.
- Add BrainStreetView's and the dependencies' folders to MATLAB's path.
MATLAB dependencies:
- allenCCF, to get Allen Atlas files
- npy-matlab, to read in .npy files
- brewermap, to generate colormaps
- prettify-matlab, to make plots pretty.
📖 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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35a7a49cb9800b8685593392e6b8fc4ed5bf55d9e8ef01b7ea9bd11e59245b6c
|
|
| MD5 |
493291b19015bcbda7d0c994cc3925ec
|
|
| BLAKE2b-256 |
06147dca19deeea3930f27b7a005247af79a1527f2e9d3b07acd07b847e1b33e
|
File details
Details for the file brain_street_view-0.1.0-py3-none-any.whl.
File metadata
- Download URL: brain_street_view-0.1.0-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5cf3fa355aa59306bd3f28cfb14ad12046064954bb87348aea3b48381107baa
|
|
| MD5 |
374ff2a5fcb694389ac793e048770b40
|
|
| BLAKE2b-256 |
d80d5ee145a803ca879f3a5fb64fdb60f28c9c3bc2431468f2140d7a1903ca81
|