Home > SuperSegger > cell > makeColonyDist.m

makeColonyDist

PURPOSE ^

makeColonyDist : returns the distance mask for the colony

SYNOPSIS ^

function dist_mask = makeColonyDist(mask)

DESCRIPTION ^

 makeColonyDist : returns the distance mask for the colony
 It dilates, the image, fills the holes, and then returns for each pixel 
 the distance from the nearest non zero pixel. 

 INPUT : 
   mask : image of mask of cells
 OUTPUT :
   dist_mask : distance between that pixel and nearest non zero pixel.

 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/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dist_mask = makeColonyDist(mask)
0002 % makeColonyDist : returns the distance mask for the colony
0003 % It dilates, the image, fills the holes, and then returns for each pixel
0004 % the distance from the nearest non zero pixel.
0005 %
0006 % INPUT :
0007 %   mask : image of mask of cells
0008 % OUTPUT :
0009 %   dist_mask : distance between that pixel and nearest non zero pixel.
0010 %
0011 % Copyright (C) 2016 Wiggins Lab
0012 % Written by Paul Wiggins.
0013 % University of Washington, 2016
0014 % This file is part of SuperSegger.
0015 %
0016 % SuperSegger is free software: you can redistribute it and/or modify
0017 % it under the terms of the GNU General Public License as published by
0018 % the Free Software Foundation, either version 3 of the License, or
0019 % (at your option) any later version.
0020 %
0021 % SuperSegger is distributed in the hope that it will be useful,
0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 % GNU General Public License for more details.
0025 %
0026 % You should have received a copy of the GNU General Public License
0027 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0028 
0029 
0030 dist_mask = imdilate(mask, strel('disk',5)); % dilates image
0031 dist_mask = imfill( dist_mask, 'holes' ); % fills holes
0032 dist_mask = ~imerode(dist_mask, strel('disk',5)); % opposite of erode
0033 dist_mask = bwdist(dist_mask); % distance to nearest non-zero pixel
0034 
0035 %imshow( dist_mask, [] );
0036 
0037 
0038 end
0039

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