Home > BauerLab > MATLAB > lib > +gcamp > procRaw.m

procRaw

PURPOSE ^

procRaw Detrends raw data (temporally and spatially)

SYNOPSIS ^

function output = procRaw(raw)

DESCRIPTION ^

procRaw Detrends raw data (temporally and spatially)
   output = procRaw(raw)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function output = procRaw(raw)
0002 %procRaw Detrends raw data (temporally and spatially)
0003 %   output = procRaw(raw)
0004 
0005 rawSize = size(raw);
0006 tSize = size(raw,4);
0007 
0008 % spatial and temporal detrending
0009 rawReshaped = reshape(raw,[],tSize);
0010 warning('Off');
0011 
0012 timeTrend = zeros(size(rawReshaped));
0013 for ii = 1:size(rawReshaped,1)
0014     timeTrend(ii,:) = polyval(polyfit(1:tSize, rawReshaped(ii,:), 4), 1:tSize);
0015 end
0016 
0017 warning('On');
0018 rawFrameOne = raw(:,:,:,1);
0019 timeTrend = reshape(timeTrend,rawSize);
0020 timeDetrend = bsxfun(@rdivide, raw, timeTrend).*repmat(rawFrameOne,1,1,1,tSize);
0021 spatTrend = bsxfun(@rdivide, mean(timeTrend,4), mean(mean(mean(timeTrend,4))));
0022 
0023 output = bsxfun(@rdivide, timeDetrend, spatTrend);
0024 end
0025

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