02.07.2013 Views

Scuola di Dottorato di Ricerca in Parodontologia Sperimentale

Scuola di Dottorato di Ricerca in Parodontologia Sperimentale

Scuola di Dottorato di Ricerca in Parodontologia Sperimentale

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

% DOMAIN is equivalent to the structur<strong>in</strong>g element used for<br />

% b<strong>in</strong>ary image operations. It is a matrix conta<strong>in</strong><strong>in</strong>g only 1's<br />

% and 0's; the 1's def<strong>in</strong>e the neighborhood for the filter<strong>in</strong>g<br />

% operation.<br />

%<br />

% For example, B=ORDFILT2(A,5,ONES(3,3)) implements a 3-by-3<br />

% me<strong>di</strong>an filter; B=ORDFILT2(A,1,ONES(3,3)) implements a 3-by-3<br />

% m<strong>in</strong>imum filter; and B=ORDFILT2(A,9,ONES(3,3)) implements a<br />

% 3-by-3 maximum filter. B=ORDFILT2(A,4,[0 1 0; 1 0 1; 0 1 0])<br />

% replaces each element <strong>in</strong> A by the maximum of its north, east,<br />

% south, and west neighbors.<br />

%<br />

% See also MEDFILT2.<br />

% Copyright 1993-2004 The MathWorks, Inc.<br />

% $Revision: 5.17.4.6 $ $Date: 2004/08/10 01:41:00 $<br />

[A,order,doma<strong>in</strong>,s,padopt,msg] = ParseInputs(vararg<strong>in</strong>{:});<br />

doma<strong>in</strong>Size = size(doma<strong>in</strong>);<br />

center = floor((doma<strong>in</strong>Size + 1) / 2);<br />

[r,c] = f<strong>in</strong>d(doma<strong>in</strong>);<br />

r = r - center(1);<br />

c = c - center(2);<br />

padSize = max(max(abs(r)), max(abs(c)));<br />

orig<strong>in</strong>alSize = size(A);<br />

if (strcmp(padopt, 'zeros'))<br />

A = padarray(A, padSize * [1 1], 0, 'both');<br />

elseif (strcmp(padopt, 'ones'))<br />

% padopt of 'ones' is for support of medfilt2; it is<br />

% undocumented<br />

A = padarray(A, padSize * [1 1], 1, 'both');<br />

else<br />

A = padarray(A, padSize * [1 1], 'symmetric', 'both');<br />

end<br />

Ma = size(A,1);<br />

offsets = c*Ma + r;<br />

% make sure that offsets are valid<br />

if ~isreal(offsets) || any(floor(offsets) ~= offsets) || any(~isf<strong>in</strong>ite(offsets))<br />

98

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!