Skip to content

Julie-Fabre/brain_street_view

Brain Street View bsv

PyPI version Tests Documentation License: GPL v3 Python 3.9+ MATLAB 2019a+

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

Available in both MATLAB and Python. Documentation

🏁 Quick start

Python:

pip install brain-street-view

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

pip install brain-street-view

Or from source:

git clone https://github.com/Julie-Fabre/brain_street_view.git
cd brain_street_view
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(
    regions=['VISp', 'VISl'])

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

# 3. Plot projections to striatum
bsv.plot_connectivity(
    experiment_data=imgs,
    allen_atlas_path='/path/to/allenCCF',
    output_region='CP',
    number_of_chunks=10,
    number_of_pixels=15,
    plane='coronal',
    region_only=True,
    smoothing=2,
    color_limits='global',
    color=None,
    normalization_info='injectionIntensity')

# 4. 3D visualization
bsv.plot_connectivity_3d(
    injection_summary=inj_summary,
    allen_atlas_path='/path/to/allenCCF',
    region_to_plot='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.

About

Load and plot Allen connectivity data in MATLAB/Python

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors