Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 35

...

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

...

    % Download and unzip the density grid file for VISp SectionDataSet   

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: #339966">% 100 micron volume 

...

size</span>
&nbsp;&nbsp;&nbsp; sizeGrid = \[133 81 115\];
&nbsp;&nbsp;&nbsp; <span style="color: #339966">% 

...

DENSITY = 3-D matrix of projection density grid 

...

volume</span>
&nbsp;&nbsp;&nbsp; fid = fopen('density.raw', 'r', 'l' );

...

&nbsp;&nbsp;&nbsp; DENSITY = fread( fid, prod(sizeGrid), 'float' );

...

&nbsp;&nbsp;&nbsp; fclose( fid );

...

&nbsp;&nbsp;&nbsp; DENSITY = reshape(DENSITY,sizeGrid);

...

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: #339966">Display>% Display one coronal and one sagittal section</span>
&nbsp;&nbsp;&nbsp; figure;imagesc(squeeze(DENSITY (95,:,\:)));caxis(\[0,1\]);colormap(hot);
&nbsp;&nbsp;&nbsp; figure;imagesc(squeeze(DENSITY (:,:,72)));caxis(\[0,1\]);colormap(hot);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

...

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

...

    % 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 density volume file for BLAa injection SectionDataSet 113144533
    mkdir('BLAa_113144533');

...


    urlwrite('http://api.brain-map.org/grid_data/download/113144533?include=density',

...

'temp.zip');

...


    unzip('temp.zip','BLAa_113144533');

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: 

...

#339966">% Gene expression grids are at 200 micron resolution.</span>

...

&nbsp;&nbsp;&nbsp; geneGridSize = \[67 41 58\];

...

&nbsp;&nbsp;&nbsp; fid = fopen('Rasd2_73636089/density.raw', 'r', 'l'&nbsp; 

...

);

...

&nbsp;&nbsp;&nbsp; Rasd2 = fread( fid, prod(geneGridSize), 'float' );

...

&nbsp;&nbsp;&nbsp; fclose(fid);

...

&nbsp;&nbsp;&nbsp; Rasd2 = reshape( Rasd2, geneGridSize );

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: 

...

#339966">% Projection grids are at 100 micron 

...

resolution</span>
&nbsp;&nbsp;&nbsp; projectionGridSize = \[133 81 115\];

...

&nbsp;&nbsp;&nbsp; fid = fopen('BLAa_113144533/density.raw', 'r', 'l'&nbsp; 

...

);

...

&nbsp;&nbsp;&nbsp; BLAa = fread( fid, prod(projectionGridSize), 'float' );

...

&nbsp;&nbsp;&nbsp; fclose(fid);

...

&nbsp;&nbsp;&nbsp; BLAa = reshape( BLAa, projectionGridSize );

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: 

...

#339966">% Upsample gene expression grid to same dimension as projection grid using linear 

...

interpolation</span>
&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; d = Rasd2; d(d<0) = 0; % fill in missing data as zeroes

...

&nbsp;&nbsp;&nbsp; Rasd2_100 = interp3(d ,xi,yi,zi,'linear');

...

    % Handle "no

...

data"

...

(-1)

...

voxels.

...


    % Create a mask of "data"

...

vs

...

"no

...

data"

...

voxels

...

and

...

apply

...

linear

...

interpolation
    m = (Rasd2  >= 0);

...

mi

...

=

...

interp3(m,xi,yi,zi,'linear');

...

    % 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;

Wiki Markup
&nbsp;&nbsp;&nbsp; <span style="color: 

...

#339966">% Create a merged image of one coronal plane;</span>

...

&nbsp;&nbsp;&nbsp; gimg = squeeze(Rasd2_100(52,:,\:)); gimg = max(0,gimg); gimg = gimg / 0.025; gimg = min(1,gimg);

...

&nbsp;&nbsp;&nbsp; pimg = squeeze(BLAa(52,:,\:)); pimg = max(0,pimg); pimg = pimg / 0.8; pimg = min(1,pimg);

...

&nbsp;&nbsp;&nbsp; rgb = zeros(\[size(gimg),3\]); rgb(:,:,1) = gimg; rgb(:,:,2) = pimg;

...

&nbsp;&nbsp;&nbsp; figure; image(rgb);

...

igureImage Added

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