Versions Compared

Key

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

...

  • Download projection_density for a VISp 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
    

...

Code Block
% -------------------------------
%
% Download a NRRD reader
% For example:
% http://www.mathworks.com/matlabcentral/fileexchange/34653-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

Anchor
ExpressionStructures
ExpressionStructures
Projection Structure Unionization

...