intRemoveFalseMicroCol : used to remove regions that are not cells. It removes anything with outline intensity below the background intensity. INPUT : mask_bg : background mask of cells phase : phase image CONST : segmentation parameters OUTPUT : mask_bg_mod : modified mask with removed regions Copyright (C) 2016 Wiggins Lab Written by 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/>.
0001 function [ mask_bg_mod ] = intRemoveFalseMicroCol( mask_bg, phase, CONST ) 0002 % intRemoveFalseMicroCol : used to remove regions that are not cells. 0003 % It removes anything with outline intensity below the background 0004 % intensity. 0005 % 0006 % INPUT : 0007 % mask_bg : background mask of cells 0008 % phase : phase image 0009 % CONST : segmentation parameters 0010 % OUTPUT : 0011 % mask_bg_mod : modified mask with removed regions 0012 % 0013 % Copyright (C) 2016 Wiggins Lab 0014 % Written by 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 % inner outline of the mask 0032 mask_bg = logical(mask_bg); 0033 mask_er = bwmorph(mask_bg, 'erode',1 ) - bwmorph(mask_bg, 'erode',2); 0034 0035 label_bg = bwlabel(mask_bg); 0036 mask_er = logical(mask_er); 0037 label_er = label_bg; 0038 label_er(~mask_er) = 0; 0039 0040 % remove labels outline that are not in background mask 0041 ind_bg = unique(label_bg(:)); 0042 ind_er = unique(label_er(:)); 0043 kill_l = ind_bg(~ismember(ind_bg, ind_er)); 0044 0045 % mean intensity of outlines 0046 props = regionprops(label_er, double(phase), 'MeanIntensity'); 0047 vals = [props.MeanIntensity]; 0048 0049 % mean intesnity of cell and non cell regions 0050 mean_noncell = mean(phase(~mask_bg)); 0051 mean_cell = mean(phase(mask_bg)); 0052 dI = mean_noncell-mean_cell; 0053 0054 % indices of regions to be removed 0055 ind = find(vals > mean_noncell-dI*CONST.superSeggerOpti.dIcellNonCell); 0056 kill_list = [kill_l',ind]; 0057 0058 mask_kill = ismember(label_bg, kill_list); 0059 mask_bg_mod = mask_bg; 0060 mask_bg_mod(mask_kill) = 0; 0061 0062 0063 0064 end 0065