Home > SuperSegger > frameLink > updateRegionFields.m

updateRegionFields

PURPOSE ^

updateRegionFields: computes the reg fields in the seg and err data structure.

SYNOPSIS ^

function data = updateRegionFields (data,CONST)

DESCRIPTION ^

 updateRegionFields: computes the reg fields in the seg and err data structure.
 using the cell mask. It also initialized the fields to be used by the
 linking aglorithm.

 INPUT :
       data    : region (cell) data structure (seg file)
       CONST   : SuperSeggerOpti set parameters

 OUTPUT :
       data : updated region (cell) data structure with regions field.

 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 data  = updateRegionFields (data,CONST)
0002 % updateRegionFields: computes the reg fields in the seg and err data structure.
0003 % using the cell mask. It also initialized the fields to be used by the
0004 % linking aglorithm.
0005 %
0006 % INPUT :
0007 %       data    : region (cell) data structure (seg file)
0008 %       CONST   : SuperSeggerOpti set parameters
0009 %
0010 % OUTPUT :
0011 %       data : updated region (cell) data structure with regions field.
0012 %
0013 % Copyright (C) 2016 Wiggins Lab
0014 % Written by Stella Stylianidou & Paul Wiggins.
0015 % University of Washington, 2016
0016 % This file is part of SuperSegger.
0017 %
0018 % SuperSegger is free software: you can redistribute it and/or modify
0019 % it under the terms of the GNU General Public License as published by
0020 % the Free Software Foundation, either version 3 of the License, or
0021 % (at your option) any later version.
0022 %
0023 % SuperSegger is distributed in the hope that it will be useful,
0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026 % GNU General Public License for more details.
0027 %
0028 % You should have received a copy of the GNU General Public License
0029 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0030 
0031 
0032 if ~isempty(data)
0033 % create regions
0034 data.regs.regs_label = bwlabel( data.mask_cell );
0035 num_regs =  max(data.regs.regs_label(:));
0036 
0037 data.regs.num_regs =num_regs;
0038 data.regs.props = regionprops( data.regs.regs_label, ...
0039     'BoundingBox','Orientation','Centroid','Area');
0040 NUM_INFO = CONST.regionScoreFun.NUM_INFO;
0041 data.regs.info = zeros( data.regs.num_regs, NUM_INFO );
0042 
0043 
0044 % initializing region fields
0045 data.regs.eccentricity = zeros(1,data.regs.num_regs);
0046 data.regs.L1 = zeros(1,data.regs.num_regs);
0047 data.regs.L2 = zeros(1,data.regs.num_regs);
0048 data.regs.contact = zeros(1,data.regs.num_regs);
0049 data.regs.neighbors = cell(1,data.regs.num_regs);
0050 data.regs.contactHist = zeros(1,data.regs.num_regs);
0051 data.regs.info= zeros(data.regs.num_regs,CONST.regionScoreFun.NUM_INFO);
0052 data.regs.scoreRaw = zeros(1,data.regs.num_regs);
0053 data.regs.score = zeros(1,data.regs.num_regs);
0054 data.regs.death = zeros(1,data.regs.num_regs); % Death/division time
0055 data.regs.deathF = zeros(1,data.regs.num_regs); % division in this frame
0056 data.regs.birth = zeros(1,data.regs.num_regs);% Birth Time: either division or appearance
0057 data.regs.birthF = zeros(1,data.regs.num_regs);% division in this frame
0058 data.regs.age = zeros(1,data.regs.num_regs);% cell age. starts at 1.
0059 data.regs.divide = zeros(1,data.regs.num_regs);% succesful division in this frame.
0060 data.regs.ehist = zeros(1,data.regs.num_regs);% True if cell has an unresolved error before this time.
0061 data.regs.stat0 = zeros(1,data.regs.num_regs); %  Successful division.
0062 data.regs.sisterID = zeros(1,data.regs.num_regs);% sister cell ID
0063 data.regs.motherID = zeros(1,data.regs.num_regs);% mother cell ID
0064 data.regs.daughterID = cell(1,data.regs.num_regs);% daughter cell ID
0065 data.regs.ID  = zeros(1,data.regs.num_regs); % cell ID number
0066 data.regs.error.label = cell(1,data.regs.num_regs);% err
0067 data.regs.ignoreError = zeros(1,data.regs.num_regs); % a flag for ignoring the error in a region.
0068 
0069 
0070 % go through the regions and update info,L1,L2 and scoreRaw.
0071 for ii = 1:data.regs.num_regs
0072      
0073     [xx,yy] = getBB(data.regs.props(ii).BoundingBox);
0074     mask = data.regs.regs_label(yy,xx)==ii;
0075     data.regs.info(ii,:) = CONST.regionScoreFun.props(mask,data.regs.props(ii) );       
0076     data.regs.L1(ii)= data.regs.info(ii,1);
0077     data.regs.L2(ii)= data.regs.info(ii,2);
0078     
0079     if CONST.trackOpti.NEIGHBOR_FLAG
0080         try
0081             data.regs.neighbors{ii} = trackOptiNeighbors(data,ii);
0082             data.regs.contact(ii)  = numel(data.regs.neighbors{ii});
0083         catch
0084             disp('Error in neighbor calculation in updateRegionFields.m');
0085         end
0086     end
0087 end
0088 
0089 
0090 data.regs.scoreRaw = CONST.regionScoreFun.fun(data.regs.info, CONST.regionScoreFun.E);
0091 data.regs.score = data.regs.scoreRaw > 0;
0092 data.regs.eccentricity = drill(data.regs.props,'.MinorAxisLength')'...
0093     ./drill(data.regs.props,'.MajorAxisLength')';
0094 end
0095 
0096 
0097 
0098 
0099 
0100 end
0101 
0102 
0103 
0104

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