Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ALLEN BRAIN ATLAS API

Table of Contents

...

maxLevel3

...

minLevel

...

2
classtoc-style

The primary data of the Allen Mouse Brain Connectivity Atlas consists of high-resolution images of axonal projections targeting different anatomic regions or various cell types using Cre-dependent specimens. Each data set is processed through an informatics data analysis pipeline to obtain spatially mapped quantified projection information.

...

Volumetric data files available download:

Data

Description

average_template

USHORT(16 bit) anatomical template of CCFv3 - a shape and intensity average of 1675 specimen brains

ara_nissl

FLOAT(32 bit) reconstructed Allen Reference Atlas Nissl deformably registered to the anatomical template of CCFv3

annotation/ccf_2016

UINT (32 bit) structure gray matter and fiber tract annotation of CCFv3 (October 2016)

annotation/ccf_2015

UINT (32 bit) structure gray matter and fiber tract annotation of CCFv3 (May 2015)

annotation/mouse_2011

UINT (32 bit) structure annotation extracted from the coronal Allen Reference Atlas and deformably registered to CCFv3

annotation/devmouse_2012

UINT (32 bit) structure annotation extracted from the P56 Allen Developing Mouse Brain Reference Atlas and deformably registered to CCFv3

Each data type is available in multiple voxel resolutions:

Voxel Resolution

Volume Dimension (AP,SI,LR)

10µm sotropic

1320

1320, 800, 1140

25µm isotropic

528, 320, 456

50µm isotropic

264, 160, 228

100µm isotropic

132, 80, 114

All volumetric data is compressed NRRD (Nearly Raw Raster Data) format. The raw numerical data is stored as a 1-D array raster as shown in the figure below.

...

Example Matlab code snippet to read in the 25µm template and annotation volumes:

Code Block

% -------------------------------
%
% Download a NRRD reader
% For example:
% http://www.mathworks.com/matlabcentral/fileexchange/50830-nrrd-format-file-reader
%
% Requires: MATLAB 7.13 (R2011b)
%
% Download average_template_25.nrrd,
%          ara_nissl_25.nrrd,
%          ccf_2015/annotation_25.nrrd
%
% ---------------------------------

%
% Read image volume with NRRD reader
% Note that reader swaps the order of the first two axes
%
% AVGT = 3-D matrix of average_template
% NISSL = 3-D matrix of ara_nissl
% ANO = 3-D matrix of ccf_2015/annotation
%
[AVGT, metaAVGT] = nrrdread('average_template_25.nrrd');
[NISSL, metaNISSL] = nrrdread('ara_nissl_25.nrrd');
[ANO, metaANO] = nrrdread('annotation_25.nrrd');


% Display one coronal section
figure;imagesc(squeeze(AVGT(:,264,:)));colormap(gray(256)); axis equal;
figure;imagesc(squeeze(NISSL(:,264,:)));colormap(gray(256)); axis equal;
figure;imagesc(squeeze(ANO(:,264,:)));
caxis([1,2000]); colormap(lines(256)); axis equal;

% Display one sagittal section
figure;imagesc(squeeze(AVGT(:,:,220)));colormap(gray(256)); axis equal;
figure;imagesc(squeeze(NISSL(:,:,220)));colormap(gray(256)); axis equal;
figure;imagesc(squeeze(ANO(:,:,220)));
caxis([1,2000]); colormap(lines(256)); axis equal;
 

Example Python code snippet to read in the 25µm template and annotation volumes:

Code Block

# -------------------------------
#
# Install pynrrd: https://github.com/mhe/pynrrd
#
# Download average_template_25.nrrd,
#          ara_nissl_25.nrrd,
#          ccf_2015/annotation_25.nrrd
#
# ---------------------------------
import nrrd
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

#
# Read image volume with NRRD reader
# Note that reader swaps the order of the first two axes
#
# AVGT = 3-D matrix of average_template
# NISSL = 3-D matrix of ara_nissl
# ANO = 3-D matrix of ccf_2015/annotation
#

AVGT, metaAVGT = nrrd.read('average_template_25.nrrd');
NISSL, metaNISSL = nrrd.read('ara_nissl_25.nrrd');
ANO, metaANO = nrrd.read('annotation_25.nrrd');

# Save one coronal section as PNG
slice = AVGT[264,:,:].astype(float)
slice /= np.max(slice)
im = Image.fromarray(np.uint8(plt.cm.gray(slice)*255))
im.save('output/avgt_coronal.png')

slice = NISSL[264,:,:].astype(float)
slice /= np.max(slice)
im = Image.fromarray(np.uint8(plt.cm.gray(slice)*255))
im.save('output/nissl_coronal.png')

slice = ANO[264,:,:].astype(float)
slice /= 2000
im = Image.fromarray(np.uint8(plt.cm.jet(slice)*255))
im.save('output/ano_coronal.png')

# Save one sagittal section as PNG
slice = AVGT[:,:,220].astype(float)
slice /= np.max(slice)
im = Image.fromarray(np.uint8(plt.cm.gray(slice)*255))
im.save('output/avgt_sagittal.png')

slice = NISSL[:,:,220].astype(float)
slice /= np.max(slice)
im = Image.fromarray(np.uint8(plt.cm.gray(slice)*255))
im.save('output/nissl_sagittal.png')

slice = ANO[:,:,220].astype(float)
slice /= 2000
im = Image.fromarray(np.uint8(plt.cm.jet(slice)*255))
im.save('output/ano_sagittal.png')

...

The red, green, and blue channels have been aligned to the 25um adult mouse brain reference space volume.  These volumes have been stored in the API WellKnownFile table with type name "ImagesResampledTo25MicronARA".  To retrieve the download link for a specific data set, query for WellKnownFiles of the appropriate type with an "attachable_id" equal to the data set id:

Code Block

http://api.brain-map.org/api/v2/data/WellKnownFile/query.xml?criteria=well_known_file_type[name$eq'ImagesResampledTo25MicronARA'][attachable_id$eq156198187]

...

Grid data for each SectionDataSet can be downloaded using the 3-D Grid Data Service. The service returns a compressed NRRD (Nearly Raw Raster Data) 32-bit FLOAT format. To download a particular grid file, the user specifies the SectionDataSet ID, the type of grid and the resolution.

Examples:

  • Download projection_density for a VISal injection SectionDataSet (id=287495026) at 50 μm resolution

    Code Block
    
    http://api.brain-map.org/grid_data/download_file/287495026??image=projection_density&resolution=50
    

Example Matlab code snippet to read in the 50 µm projection_density grid volume and average_template:

Code Block

% -------------------------------
%
% Download a NRRD reader
% For example:
% http://www.mathworks.com/matlabcentral/fileexchange/50830-nrrd-format-file-reader
%
% Requires: MATLAB 7.13 (R2011b)
%
% Download average_template_50.nrrd
% Download projection_density at 50 micron for SectionDataSet id = 287495026
%
% ---------------------------------

%
% Read image volume with NRRD reader
% Note that reader swaps the order of the first two axes
%
% AVGT = 3-D matrix of average_template
% PDENS = 3-D matrix of projection_density
% DMASK = 3-D matrix of data_mask
%
[AVGT, metaAVGT] = nrrdread('average_template_50.nrrd');
[PDENS, metaPDENS] = nrrdread('11_wks_coronal_287495026_50um_projection_density.nrrd');
[DMASK, metaDMASK] = nrrdread('11_wks_coronal_287495026_50um_data_mask.nrrd');

% Display one coronal section
figure;imagesc(squeeze(AVGT(:,184,:)));colormap(gray(256)); axis equal;
figure;imagesc(squeeze(PDENS(:,184,:)));colormap(jet(256)); axis equal;
figure;imagesc(squeeze(DMASK(:,184,:)));colormap(gray(256)); axis equal;

Example Python code snippet to read in the 50 µm injection_density and injection_fraction and compute an injection centroid:

Code Block

# -------------------------------
#
# Install pynrrd: https://github.com/mhe/pynrrd
#
# Download injection_density at 50 micron for SectionDataSet id = 287495026
# Download injection_fraction at 50 micron for SectionDataSet id = 287495026
#
# ---------------------------------
import nrrd
import numpy as np
import matplotlib.pyplot as plt
import Image

#
# Read image volume with NRRD reader
# Note that reader swaps the order of the first two axes
#
# INJDENS = 3-D matrix of injection_density
# INJFRAC = 3-D matrix of injection_fraction
#

INJDENS, metaINJDENS = nrrd.read('11_wks_coronal_287495026_50um_projection_density.nrrd');
INJFRAC, metaINJFRAC = nrrd.read('11_wks_coronal_287495026_50um_injection_fraction.nrrd');

# find all voxels with injection_fraction >= 1
injection_voxels = np.where( INJFRAC >= 1 )
injection_density = INJDENS[injection_voxels]
sum_density = sum(injection_density)

# compute centroid in CCF coordinates
centroid = map( lambda x : sum( injection_density * x ) / sum_density * 50, injection_voxels)
print centroid

...

The output of the source search is a xml list of objects. Each object represents one experiment and contains information about the experiment including its unique identifier, the primary injection structure, list of any secondary injection structures, injection coordinates, injection volume and transgenic line name.

Examples:

  • Source search for experiments with injection in the isocortex

    No Format
    
    http://api.brain-map.org/api/v2/data/query.json?criteria=
    service::mouse_connectivity_injection_structure[injection_structures$eqIsocortex][primary_structure_only$eqtrue]
    
  • Source search for experiments performed on wild-type specimens and with injection in the isocortex

    No Format
    
    http://api.brain-map.org/api/v2/data/query.json?criteria=
    service::mouse_connectivity_injection_structure[injection_structures$eqIsocortex][transgenic_lines$eq0][primary_structure_only$eqtrue]
    
  • Source search for experiments performed on Syt6-Cre_KI148 cre-line specimens and with injection in the isocortex

    No Format
    
    http://api.brain-map.org/api/v2/data/query.json?criteria=
    service::mouse_connectivity_injection_structure[injection_structures$eqIsocortex][transgenic_lines$eq'Syt6-Cre_KI148'][primary_structure_only$eqtrue]
    

...

The output of the target search is a xml list of objects. Each object represents one experiment and contains information about the experiment including its unique identifier, the primary injection structure, list of any secondary injection structures, injection coordinates, injection volume and transgenic line name. Additionally, the total signal volume and number of voxels spanned by the target structure(s) is also reported.

Example:

  • Target search for experiments with projection signal in the target structure LGd (dorsal part of the lateral geniculate complex) and injection in the isocortex

    No Format
    
    http://api.brain-map.org/api/v2/data/query.json?criteria=
    service::mouse_connectivity_injection_structure[injection_structures$eqIsocortex][primary_structure_only$eqtrue][target_domain$eqLGd]
    

...

The output of the target search is a xml list of objects. Each object represents one experiment and contains information about the experiment including its unique identifier, the primary injection structure, list of any secondary injection structures, injection coordinates, injection volume and transgenic line name. Additionally, the path from the target location to the injection site is listed along with signal density at each node.

Example:

  • Spatial search for experiments with projection signal in a target location in VM (ventral medial nucleus of the thalamus)

    No Format
    
    http://api.brain-map.org/api/v2/data/query.xml?criteria=
    service::mouse_connectivity_target_spatial[seed_point$eq6900,5050,6450]
    

...

Example: Injection coordinate search for experiments with a seed location in VM (ventral medial nucleus of the thalamus)

No Format

http://api.brain-map.org/api/v2/data/query.xml?criteria=
service::mouse_connectivity_injection_coordinate[seed_point$eq6900,5050,6450]

...

The output of the injection coordinate search is a xml list of objects. Each object represents one experiment and contains information about the experiment including its unique identifier, the primary injection structure, list of any secondary injection structures, injection coordinates, injection volume and transgenic line name. Additionally, the Pearson's correlation coefficient between the experiment and the seed is reported.

Example:

  • Correlation search for experiment with similar projection profile in the thalamus compared to seed experiment 112670853 (injection in primary motor area of the cortex)

    No Format
    
    http://api.brain-map.org/api/v2/data/query.xml?criteria=
    service::mouse_connectivity_correlation[row$eq112670853][structures$eqTH]
    

...