...

**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

Wiki MarkupThe 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|http://www.itk.org/Wiki/MetaIO/Documentation] format. Structural annotation for each grid voxel can be obtained via the ReferenceSpace [gridAnnotation|http://iwarehouse/api/v2/well_known_file_download/159081322] volume file at 100 µm grid resolutiongridAnnotation volume file at 100 µm grid resolution.

Voxels with no data are assigned a value of "-1".

**Examples:**

**Example Matlab code snippet to read in the 100 µm density grid volume:**

Code Block |
---|

%------------ % Download and unzip the density grid file for VISp SectionDataSet % ----------- % grid % 100 micron volume size volume size sizeGrid = [133, 81, 115]; % DENSITY = 3-D matrix of projection density grid volume fid = fopen('11_wks_coronal_126862385/density.raw', 'r', 'l' ); DENSITY = fread( fid, prod(sizeGrid), 'float' ); fclose( fid ); DENSITY = reshape(DENSITY,sizeGrid); % Display one coronal and one sagittal section figure;imagesc(squeeze(DENSITY (9573,:,:)));colormap(hot);caxis([0, 1]);colormap(hot); figure; figure;imagesc(squeeze(DENSITY (:,:,7278)));colormap(hot);caxis([0, 1]);colormap(hot); |

### Projection Structure Unionization

Projection signal statistics can be computed for each structure delineated in the reference atlas by combining or unionizing grid voxels with the same 3-D structural label. While the reference atlas is typically annotated at the lowest level of the ontology tree, statistics at upper level structures can be obtained by combining measurements 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.

Projection statistics are encapsulated as a ProjectionStructureUnionize object associated with one Structure, either left, right or both Hemispheres and one SectionDataSet.

**Example:**

- Download structure projection signal statistics for one VISp injection experiment exclusive of injection area
- Download injection site statistics for the same experiment

ProjectionStructureUnionize data is used in the web application to display projection summary bar graphs.

### Comparing Projection Data Grids and Gene Expression Grids

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. When interpolating the data, "no data" (-1) voxels needs to be handled specifically.

Example Matlab code snippet to upsample gene expression grid with "no data" handling:

...

### Comparing Projection Data Grids and Gene Expression Grids

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. When interpolating the data, "no data" (-1) voxels needs to be handled specifically.

Example Matlab code snippet to upsample gene expression grid with "no data" handling:

Code Block |
---|

% Download and unzip energy volume file for gene Rasd2 coronal SectionDataSet 73636089 mkdir('Rasd2_73636089'); urlwrite('http://api.brain-map.org/grid_data/download/74819249?include=density', 'temp.zip'); unzip('temp.zip','Rasd2_73636089'); % Download and unzip energydensity volume file for geneBLAa Rasd2 coronalinjection SectionDataSet 73636089113144533 mkdir('Rasd2BLAa_73636089113144533'); urlwrite('http://api.brain-map.org/grid_data/download/74819249113144533?include=density', 'temp.zip'); unzip('temp.zip','Rasd2BLAa_73636089113144533'); % DownloadGene andexpression unzipgrids densityare volumeat file200 formicron BLAaresolution. injection SectionDataSet 113144533 geneGridSize = mkdir('BLAa_113144533')[67 41 58]; urlwrite('http://api.brain-map.org/grid_data/download/113144533?include=densityfid = fopen('Rasd2_73636089/density.raw', 'r', 'temp.zipl' ); unzip('temp.zip','BLAa_113144533'Rasd2 = fread( fid, prod(geneGridSize), 'float' ); fclose(fid); Rasd2 = reshape( Rasd2, geneGridSize ); % Gene expressionProjection grids are at 200100 micron resolution. geneGridSizeprojectionGridSize = [67133 4181 58115]; fid = fopen('Rasd2BLAa_73636089113144533/density.raw', 'r', 'l' ); Rasd2BLAa = fread( fid, prod(geneGridSizeprojectionGridSize), 'float' ); fclose(fid); Rasd2BLAa = reshape( Rasd2BLAa, geneGridSizeprojectionGridSize ); % ProjectionUpsample gridsgene areexpression atgrid 100to micronsame resolution dimension as projection grid projectionGridSizeusing = [133 81 115];linear interpolation fid[xi,yi,zi] = fopen('BLAa_113144533/density.raw', 'r', 'l' );meshgrid(1:0.5:41,1:0.5:67,1:0.5:58); %note: matlab transposes x-y BLAad = fread( fid, prod(projectionGridSize), 'float' ); fclose(fid);Rasd2; d(d<0) = 0; % fill in missing data as zeroes BLAaRasd2_100 = reshapeinterp3( BLAa, projectionGridSize ); d ,xi,yi,zi,'linear'); % Handle "no data" (-1) voxels. % UpsampleCreate genea expressionmask gridof to"data" samevs dimension"no asdata" projectionvoxels gridand usingapply linear interpolation [xi,yi,zi]m = (Rasd2 >= 0); mi = meshgrid(1:0.5:41,1:0.5:67,1:0.5:58); %note: matlab transposes x-y d = Rasd2; d(d<0) = 0; % fill in missing data as zeroesinterp3(m,xi,yi,zi,'linear'); % Normalize data by dividing by interpolated mask. Assign value of "-1" to "no data" voxels. Rasd2_100 = interp3(d ,xi,yi,zi,'linear'); Rasd2_100 ./ mi; % Handle "no data" (-1) voxels.Rasd2_100( mi <= 0 ) = -1; % Create a merged maskimage of "data"one vs "no data" voxels and apply linear interpolationcoronal plane; mgimg = squeeze(Rasd2_100(52,:,:)); gimg >= max(0,gimg); migimg = interp3(m,xi,yi,zi,'linear'gimg / 0.025; gimg = min(1,gimg); % Normalize data by dividing by interpolated mask. Assign value of "-1" to "no data" voxels. Rasd2_100 = Rasd2_100 ./ mi; Rasd2_100( mi <= 0 ) = -1; % Create a merged image of one coronal plane; gimg = squeeze(Rasd2_100(52,:,:)); gimg = max(0,gimg); gimg = gimg / 0.025; gimg = min(1,gimg); pimg = squeeze(BLAa(52,:,:)); pimg = max(0,pimg); pimg = pimg / 0.8; pimg = min(1,pimg); rgb = zeros([size(gimg),3]); rgb(:,:,1) = gimg; rgb(:,:,2) = pimg; figure; image(rgb); |

...

```
pimg = squeeze(BLAa(52,:,:)); pimg = max(0,pimg); pimg = pimg / 0.8; pimg = min(1,pimg);
rgb = zeros([size(gimg),3]); rgb(:,:,1) = gimg; rgb(:,:,2) = pimg;
figure; image(rgb);
``` |

**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).

### Projection Structure Unionization

Projection signal statistics can be computed for each structure delineated in the reference atlas by combining or unionizing grid voxels with the same 3-D structural label. While the reference atlas is typically annotated at the lowest level of the ontology tree, statistics at upper level structures can be obtained by combining measurements 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.

Projection statistics are encapsulated as a ProjectionStructureUnionize object associated with one Structure, either left, right or both Hemispheres and one SectionDataSet.

**Example:**

- Download structure projection signal statistics for one VISp injection experiment exclusive of injection area
- Download injection site statistics for the same experiment

ProjectionStructureUnionize data is used in the web application to display projection summary bar graphs.