Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h1. API: Mouse Connectivity Resources\\

h3. Mouse Connectivity Projection Data: Informatics Data Processing Pipeline

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. The informatics data processing pipeline produces results that enable the navigation, analysis and visualization of this data. 

The output of the pipeline is quantified signal values at a grid voxel level and at a structure level according to the integrated reference atlas ontology. The grid level data are used downstream to provide an on-the-fly data and search service and to support visualization of spatial relationships. 

Refer to the \[informatics whitepaper\]([|]) for detailed methods used in the pipeline. 

h3. Mouse Connectivity Projection Experiments 

Experimental data from the Atlas is associated with the "Mouse Connectivity Projection" Product. 

Each Specimen is injected with a viral tracer that labels axons by expressing a fluorescent protein. For each experiment,  the injection site is analyzed and assigned a primary injection structure and if applicable a list of secondary injection structures. 

Labeled axons are visualized using serial two-photon tomography. A typical dataset consists of 140 coronal images at 100 µm sampling density.  Each image has 0.35 µm pixel resolution and raw data is in 16-bit per channel format.  \\

From the API, detailed information about images, injection annotation and transgenic lines can be obtained using RMA queries.  __*Examples{:*_}_ _

_\* \[__[All experiments in the "Mouse Connectivity Projection" Product|/api/v2/data/query.xml?criteria=model::SectionDataSet,rma::criteria,products[id$eq5],rma::include,specimen(injections(primary_injection_structure,structure))]__\](/api/v2/data/query.xml?criteria=model::SectionDataSet,rma::criteria,products\[id$eq5\],rma::include,specimen(injections(primary_injection_structure,structure)))_

_\* \[All experiments with injection in the primary visual area (VISp, structure_id=385)\](/api/v2/data/query.xml?criteria=model::SectionDataSet,rma::criteria,products\[id$eq5\],rma::include,specimen(injections(structure\[id$eq385\])))_

_\* \[Detailed metadata for one experiment with injection in the VISp (id=126862385)\](/api/v2/data/query.xml?criteria=model::SectionDataSet,rma::criteria,\[id$eq126862385\],rma::include,specimen(injections(structure\[id$eq385\])),equalization,sub_images,rma::options\[order$eq'sub_images.section_number$asc'\])&nbsp; <img width="500px" src="/images/Connectivity_VISp.jpg.png" />&nbsp;_

_Figure{_}{*}{*}_: Projection dataset (id=126862385) with injection in the primary visual area (VISp) as visualized in the web application image viewer.&nbsp; To provide a uniform look over all experiments, default window and level values were computed using intensity histograms.&nbsp; For each experiment, the upper threshold defaults to (2.33 x the 95th percentile value) for the red channel and (6.33 x the 95th percentile value)&nbsp; for the green channel. The default threshold can be used to download images and/or image region in 8-bit per channel image format.&nbsp; \__Examples{_}{*}*\_&nbsp; * \[RMA query to fetch meta-information of one projection image\](/api/v2/data/query.xml?criteria=model::SectionDataSet,rma::criteria,\[id$eq126862385\],rma::include,equalization,sub_images\[section_number$eq74\]) * \[Download image downsampled by factor of 6 using default thresholds\](/api/v2/section_image_download/126862575?downsample=6&range=0,932,0,1279,0,4095) * \[Download a region of interest at full resolution using default thresholds\](/api/v2/section_image_download/126862575?left=19045&top=11684&width=1000&height=1000&range=0,932,0,1279,0,4095)&nbsp; ### 3-D Reference Model for Mouse Connectivity&nbsp; The backbone of the automated pipeline is an annotated 3-D reference space.&nbsp; Similarly to gene expression data in the \[Allen Mouse Brain Atlas\](\**[|]**),&nbsp; each projection dataset is registered to the \[3-D reference space\](#3-D_Reference_Models) built upon the coronal \[Allen Reference Atlas\](**[|]**) specimen.&nbsp; To avoid possible bias introduced by using a single specimen as a registration target, the Nissl-based 3-D reference volume was not directly used. Instead, a large number of brains were mapped in advanced and averaged to form the registration target. This averaged template maybe updated periodically to include more brain specimens and is available for download as an unsigned 16-bit grayscale volume through this \[link\](/api/v2/well_known_file_download/178344616).&nbsp; As with gene expression datasets, an \[image synchronization service\](#Image-to-Image_Synchronization) is available to find corresponding position&nbsp; between datasets within the Mouse Connectivity Projection product and across to datasets in the Mouse Brain and Developing Mouse Brain products.&nbsp;&nbsp; <img width="650px" src="/images/Connectivity_ImageSync.jpg.png" />&nbsp; \**Figure{*}*: Point-based image synchronization. Multiple image-series in the Zoom-and-Pan (Zap) viewer can be synchronized to the same approximate location.&nbsp; Before and after synchronization screenshots show projection data with injection in the superior colliculus (SCs), primary visual area (VISp)&nbsp; anteolateral visual area (VISal), and the relevant coronal plates of the Allen Reference Atlas. All experiments show strong signal in the thalamus.&nbsp; ### Projection Data Segmentation&nbsp; For every Projection image, a gray scale mask is generated that identifies pixels corresponding to labeled axon trajectories.&nbsp; The segmentation algorithm is based on image edge/line detection and morphological filtering.&nbsp; The segmentation mask image is the same size and pixel resolution as the primary projection image and can be \[downloaded\](#Projection_Image_Download_Service).&nbsp; <img width="650px" src="/images/Connectivity_Segmentation.jpg.png" />&nbsp; \**Figure{*}*: Signal detection for projection data with injection in the primary motor area. Screenshot of a segmentation mask showing detected signal in the ventral posterolateral nucleus of the thalamus (VPL),&nbsp; internal capsule (int), caudoputamen (CP) and supplemental somatosensory area (SSs).&nbsp; In the Web application, the mask is color-coded for display: green indicates a pixel is part of an edge-like object while yellow indicates pixels that are part of a more diffuse region.&nbsp; ### Projection Data Gridding&nbsp; For each dataset, the gridding module creates a low resolution 3-D summary of the labeled axonal trajectories and&nbsp; resamples the data to the common coordinate space of the 3-D reference model. Casting all data into a canonical space&nbsp; allows for easy cross-comparison between datasets. The projection data grids can also be viewed directly as 3-D volumes&nbsp; or used for analysis (i.e. afferent and correlative searches).&nbsp; Each image in a dataset is divided into a 100 x 100 µm grid.&nbsp; Pixel-based statistics are computed using information from the primary image and the segmentation mask:&nbsp; * \**projection density*\* = sum of detected pixels / sum of all pixels in division * **projection intensity*\* = sum of detected pixel intensity / sum of detected pixels * **projection energy*\* = projection intensity * projection density&nbsp; The resulting 3-D grid is then transformed into the standard reference space. Grid data can be downloaded for each SectionDataSet using the \[3-D Grid Data Service\](/doc/index.html#Downloading_3-D_Expression_Grid_Data). The service returns a zip file containing the volumetric data for density, intensity and/or energy in an uncompressed format with a simple text header file in \[MetaImage\]([|]) format. Structural annotation for each grid voxel can be obtained via the ReferenceSpace \[gridAnnotation\](/api/v2/well_known_file_download/159081322) volume file at 100 µm grid resolution.&nbsp; **Examples:**&nbsp; * \[Download projection grid file for one experiment with injection in the VISp (id=126862385)\](/grid_data/download/126862385?include=density)&nbsp; \**Example Matlab code snippet to read in the 100 µm density grid volume:*\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Download and unzip the density grid file for VISp SectionDataSet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % 100 micron volume size&nbsp;&nbsp;&nbsp;&nbsp; sizeGrid = \[133 81 115\];&nbsp;&nbsp;&nbsp;&nbsp; % DENSITY = 3-D matrix of projection density grid volume&nbsp;&nbsp;&nbsp;&nbsp; fid = fopen('density.raw', 'r', 'l' );&nbsp;&nbsp;&nbsp;&nbsp; DENSITY = fread( fid, prod(sizeGrid), 'float' );&nbsp;&nbsp;&nbsp;&nbsp; fclose( fid );&nbsp;&nbsp;&nbsp;&nbsp; DENSITY = reshape(DENSITY,sizeGrid);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Display one coronal and one sagittal section&nbsp;&nbsp;&nbsp;&nbsp; figure;imagesc(squeeze(DENSITY (95,:,\:)));caxis(\[0,1\]);colormap(hot);&nbsp;&nbsp;&nbsp;&nbsp; figure;imagesc(squeeze(DENSITY (:,:,72)));caxis(\[0,1\]);colormap(hot);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" onmouseover="hover" title="Back to top"><img width="18px" height="20px" src="/images/back_to_top.png" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ### Projection Structure Unionization&nbsp; Projection signal statistics can be computed for each structure delineated in the reference atlas by combining&nbsp; or unionizing grid voxels with the same 3-D structural label. While the reference atlas is typically annotated&nbsp; at the lowest level of the ontology tree, statistics at upper level structures can be obtained by combining measurements&nbsp; of the hierarchical children to obtain statistics for the parent structure. The unionization process also separates out the left versus right hemisphere contributions as well as the injection versus non-injection components.&nbsp; Projection statistics are encapsulated as a {ProjectionStructureUnionize}object associated with one {Structure}, either left, right or both Hemispheres and one {SectionDataSet}.&nbsp; **Example:**&nbsp; * \[Download structure projection signal statistics for one VISp injection experiment exclusive of injection area\](/api/v2/data/ProjectionStructureUnionize/query.xml?criteria=\[section_data_set_id$eq126862385\],\[is_injection$eqfalse\]&num_rows=5000&include=structure) * \[Download injection site statistics for the same experiment\](/api/v2/data/ProjectionStructureUnionize/query.xml?criteria=\[section_data_set_id$eq126862385\],\[is_injection$eqtrue\]&num_rows=5000&include=structure)&nbsp;&nbsp; ProjectionStructureUnionize data is used in the web application to display projection summary bar graphs.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" onmouseover="hover" title="Back to top"><img width="18px" height="20px" src="/images/back_to_top.png" /></a>&nbsp; ### Comparing Projection Data Grids and Gene Expression Grids&nbsp; Due to section sampling density, projection data grids are at 100µm resolution while gene expression grids are at 200µm resolution. Upsampling with appropriate interpolation of the gene expression data is necessary in order to numerically compare between the two different types of data.&nbsp; When interpolating the data, "no data" (-1) voxels needs to be handled specifically.&nbsp; Example Matlab code snippet to upsample gene expression grid with "no data" handling:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Download and unzip energy volume file for gene Rasd2 coronal SectionDataSet 73636089&nbsp;&nbsp;&nbsp;&nbsp; mkdir('Rasd2_73636089');&nbsp;&nbsp;&nbsp;&nbsp; urlwrite('', '');&nbsp;&nbsp;&nbsp;&nbsp; unzip('','Rasd2_73636089');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Download and unzip density volume file for BLAa injection SectionDataSet 113144533&nbsp;&nbsp;&nbsp;&nbsp; mkdir('BLAa_113144533');&nbsp;&nbsp;&nbsp;&nbsp; urlwrite('', '');&nbsp;&nbsp;&nbsp;&nbsp; unzip('','BLAa_113144533');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Gene expression grids are at 200 micron resolution.&nbsp;&nbsp;&nbsp;&nbsp; geneGridSize = \[67 41 58\];&nbsp;&nbsp;&nbsp;&nbsp; fid = fopen('Rasd2_73636089/density.raw', 'r', 'l'&nbsp; );&nbsp;&nbsp;&nbsp;&nbsp; Rasd2 = fread( fid, prod(geneGridSize), 'float' );&nbsp;&nbsp;&nbsp;&nbsp; fclose(fid);&nbsp;&nbsp;&nbsp;&nbsp; Rasd2 = reshape( Rasd2, geneGridSize );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Projection grids are at 100 micron resolution&nbsp;&nbsp;&nbsp;&nbsp; projectionGridSize = \[133 81 115\];&nbsp;&nbsp;&nbsp;&nbsp; fid = fopen('BLAa_113144533/density.raw', 'r', 'l'&nbsp; );&nbsp;&nbsp;&nbsp;&nbsp; BLAa = fread( fid, prod(projectionGridSize), 'float' );&nbsp;&nbsp;&nbsp;&nbsp; fclose(fid);&nbsp;&nbsp;&nbsp;&nbsp; BLAa = reshape( BLAa, projectionGridSize );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Upsample gene expression grid to same dimension as projection grid using linear interpolation&nbsp;&nbsp;&nbsp;&nbsp; \[xi,yi,zi\] = meshgrid(1:0.5:41,1:0.5:67,1:0.5:58); %note: matlab transposes x-y&nbsp;&nbsp;&nbsp;&nbsp; d = Rasd2; d(d<0) = 0; % fill in missing data as zeroes&nbsp;&nbsp;&nbsp;&nbsp; Rasd2_100 = interp3(d ,xi,yi,zi,'linear');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Handle "no data" (-1) voxels.&nbsp;&nbsp;&nbsp;&nbsp; % Create a mask of "data" vs "no data" voxels and apply linear interpolation&nbsp;&nbsp;&nbsp;&nbsp; m = (Rasd2&nbsp; >= 0); mi = interp3(m,xi,yi,zi,'linear');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Normalize data by dividing by interpolated mask. Assign value of "-1" to "no data" voxels.&nbsp;&nbsp;&nbsp;&nbsp; Rasd2_100 = Rasd2_100 ./ mi;&nbsp;&nbsp;&nbsp;&nbsp; Rasd2_100( mi <= 0 ) = \-1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % Create a merged image of one coronal plane;&nbsp;&nbsp;&nbsp;&nbsp; gimg = squeeze(Rasd2_100(52,:,\:)); gimg = max(0,gimg); gimg = gimg / 0.025; gimg = min(1,gimg);&nbsp;&nbsp;&nbsp;&nbsp; pimg = squeeze(BLAa(52,:,\:)); pimg = max(0,pimg); pimg = pimg / 0.8; pimg = min(1,pimg);&nbsp;&nbsp;&nbsp;&nbsp; rgb = zeros(\[size(gimg),3\]); rgb(:,:,1) = gimg; rgb(:,:,2) = pimg;&nbsp;&nbsp;&nbsp;&nbsp; figure; image(rgb);&nbsp; <img width="800px" src="/images/UpsampleGeneExpressionGrid.jpg" />&nbsp; \**Figure:*\* ISH SectionDataSet (id=73636089) for gene Rasd2 showing enriched expression in the striatum (left). Projection SectionDataSet (id=73636089) with injection in the anterior part of the basolateral amygdalar nucleus (BLAa) showing projection to the striatum and other brain areas (center). One coronal slice of the BLAa projection density grid (green) merged with an upsampled and interpolated Rasd2 expression density grid (red).&nbsp; <a href="#" onmouseover="hover" title="Back to top"><img width="18px" height="20px" src="/images/back_to_top.png" /></a>