Home > SuperSegger > fluorescence > trackOptiCellFluor.m

trackOptiCellFluor

PURPOSE ^

trackOptiCellFluor : Computes fluorescence statistics

SYNOPSIS ^

function fl = trackOptiCellFluor( fluor, mask, r_offset )

DESCRIPTION ^

 trackOptiCellFluor : Computes fluorescence statistics

 INPUT :
       fluor: fluorescence image
       mask : cell mask
       r_offset : offset in global coordinates
 OUTPUT :
       fl.sum : sum of fluorescence of all pixels within cell mask
       fl.r : the coordinates of the center of mass of the fluorescence
       fl.Ixx : second moment of fluorescence along X 
       fl.Iyy : second moment of fluorescence along Y
       fl.Ixy : second moment of fluorescence along YX

 Copyright (C) 2016 Wiggins Lab
 Written by Stella Stylianidou & Paul Wiggins.
 University of Washington, 2016
 This file is part of SuperSegger.

 SuperSegger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 SuperSegger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fl = trackOptiCellFluor( fluor, mask, r_offset )
0002 % trackOptiCellFluor : Computes fluorescence statistics
0003 %
0004 % INPUT :
0005 %       fluor: fluorescence image
0006 %       mask : cell mask
0007 %       r_offset : offset in global coordinates
0008 % OUTPUT :
0009 %       fl.sum : sum of fluorescence of all pixels within cell mask
0010 %       fl.r : the coordinates of the center of mass of the fluorescence
0011 %       fl.Ixx : second moment of fluorescence along X
0012 %       fl.Iyy : second moment of fluorescence along Y
0013 %       fl.Ixy : second moment of fluorescence along YX
0014 %
0015 % Copyright (C) 2016 Wiggins Lab
0016 % Written by Stella Stylianidou & Paul Wiggins.
0017 % University of Washington, 2016
0018 % This file is part of SuperSegger.
0019 %
0020 % SuperSegger is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % SuperSegger is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 fl = [];
0034 fl.sum = sum(double(fluor(mask(:))));
0035 im_size   = size(mask);
0036 im_size_x = im_size(2);
0037 im_size_y = im_size(1);
0038 
0039 xx = (1:im_size_x)+r_offset(1)-1;
0040 yy = (1:im_size_y)+r_offset(2)-1;
0041 [X,Y] = meshgrid( xx, yy );
0042 
0043 Xcm = sum(X(mask(:)).*double(fluor(mask(:))))/fl.sum;
0044 Ycm = sum(Y(mask(:)).*double(fluor(mask(:))))/fl.sum;
0045 
0046 fl.r = [Xcm,Ycm];
0047 fl.Ixx = sum(double(fluor(mask(:))).*(X(mask(:))-Xcm).^2)/fl.sum;
0048 fl.Iyy = sum(double(fluor(mask(:))).*(Y(mask(:))-Ycm).^2)/fl.sum;
0049 fl.Ixy = sum(double(fluor(mask(:))).*(Y(mask(:))-Ycm).*(X(mask(:))-Xcm))/fl.sum;
0050 
0051 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005