Versions Compared

Key

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

...

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

    % 100 micron volume size
    sizeGrid = [133 81 115];
    % DENSITY = 3-D matrix of projection density grid volume
    fid = fopen('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 (95,:,:)));caxis([0,1]);colormap(hot);
    figure;imagesc(squeeze(DENSITY (:,:,72)));caxis([0,1]);colormap(hot);

      

Projection Structure Unionization

...

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:

     

...

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

...

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