Home > BauerLab > MATLAB > lib > +mouse > +expSpecific > getAvgLED.m

getAvgLED

PURPOSE ^

getAvgLED Obtains average LED data from area indicated by indices.

SYNOPSIS ^

function avgLED = getAvgLED(data,ind)

DESCRIPTION ^

getAvgLED Obtains average LED data from area indicated by indices.
Saturation is considered (hard-coded to 300-14000 range)
   data = 3D matrix of raw data(spatial x spatial x time)
   ind = vector (indices that will be considered for getting average led)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function avgLED = getAvgLED(data,ind)
0002 %getAvgLED Obtains average LED data from area indicated by indices.
0003 %Saturation is considered (hard-coded to 300-14000 range)
0004 %   data = 3D matrix of raw data(spatial x spatial x time)
0005 %   ind = vector (indices that will be considered for getting average led)
0006 
0007 dataVect = squeeze(reshape(data,size(data,1)*size(data,2),size(data,3)));
0008 dataVect = dataVect(ind,:);
0009 
0010 % get pixels that are saturated
0011 saturated = false(1,size(dataVect,1));
0012 saturationUpperThr = 14000;
0013 saturationLowerThr = 300;
0014 for pix = 1:size(dataVect,1)
0015     pixIntensity = squeeze(dataVect(pix,:));
0016     % condition for saturation
0017     saturated(:,pix) = (mean(pixIntensity) > saturationUpperThr) ...
0018         | (mean(pixIntensity) < saturationLowerThr);
0019 end
0020 dataVect = dataVect(~saturated,:);
0021 avgLED = squeeze(nanmean(dataVect));
0022 end
0023

Generated on Fri 28-Dec-2018 21:42:50 by m2html © 2005