Load and plot Allen Connectivity Data (Oh et al., Nature, 2014)
Available in both MATLAB and Python. Documentation
Python:
pip install brain-street-viewThen 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.
pip install brain-street-viewOr 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
- 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.
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.
% 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.
- 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)
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.




