GRDILATE Morphological dilation on graph. LBL2 = grDilate(EDGES, LBL1) Each label of the graph is assigned the highest label of its neighbours, or it keeps the same label this one is bigger. Example grDilate See also grErode, grOpen, grClose
0001 function varargout = grDilate(varargin) 0002 %GRDILATE Morphological dilation on graph. 0003 % 0004 % LBL2 = grDilate(EDGES, LBL1) 0005 % Each label of the graph is assigned the highest label of its 0006 % neighbours, or it keeps the same label this one is bigger. 0007 % 0008 % Example 0009 % grDilate 0010 % 0011 % See also 0012 % grErode, grOpen, grClose 0013 % 0014 0015 % ------ 0016 % Author: David Legland 0017 % E-mail: david.legland@inrae.fr 0018 % Created: 2006-01-20 0019 % Copyright 2006-2024 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas) 0020 0021 if length(varargin) == 2 0022 edges = varargin{1}; 0023 lbl = varargin{2}; 0024 elseif length(varargin) == 3 0025 edges = varargin{2}; 0026 lbl = varargin{3}; 0027 else 0028 error('Wrong number of arguments in "grDilate"'); 0029 end 0030 0031 0032 lbl2 = zeros(size(lbl)); 0033 0034 uni = unique(edges(:)); 0035 for n = 1:length(uni) 0036 neigh = grAdjacentNodes(edges, uni(n)); 0037 lbl2(uni(n)) = max(lbl([uni(n); neigh])); 0038 end 0039 0040 varargout{1} = lbl2;