function y = mmis( f1, oper, f2, oper1, f3 ) % MMIS Verify if a relationship among images is true or false. % % Y = MMIS( F1, OPER, F2, OPER1, F3 ) % % Input: % F1 - Gray-scale (uint8 or uint16) or binary image (logical uint8). % OPER - String. relationship from: '==', '~=', '<','<=', '>', '>=', % 'binary', 'gray'. % F2 - Gray-scale (uint8 or uint16) or binary image (logical uint8). % DEFAULT: No parameter. % OPER1 - String. relationship from: '==', '~=', '<','<=', '>', '>= % '. DEFAULT: No parameter. % F3 - Gray-scale (uint8 or uint16) or binary image (logical uint8). % DEFAULT: No parameter. % % Output: % Y - Bool value: 0 or 1 % % Verify if the property or relatioship between images is true or % false. The result is true if the relationship is true for all the % pixels in the image, and false otherwise. (Obs: This function % replaces MMISEQUAL, MMISLESSEQ, MMISBINARY). % % Examples % -------- % % fbin=logical(uint8([0 1])); % f1=uint8([1 2 3]); % f2=uint8([2 2 3]); % f3=uint8([2 3 4]); % mmis(fbin,'binary') % mmis(f1,'gray') % mmis(f1,'==',f2) % mmis(f1,'<',f3) % mmis(f1,'<=',f2) % mmis(f1,'<=',f2,'<=',f3) % % See also MMBINARY, MMCMP, MMFREEDOM, MMGRAY. % begin of the default argument automatic treatment % end of the default argument automatic treatment 1 if nargin==1 disp('Error: mmis requires at least 2 argments'); return; elseif nargin==2 oper=upper(oper); if strcmp('BINARY',oper) y=mmisbinary(f1); elseif strcmp('GRAY',oper) y= ~mmisbinary(f1); else disp('Error: oper must be one of: binary or gray, when used with 2 args'); end elseif (nargin==3) | (nargin==5) if strcmp('==',oper) y= mmisequal(f1,f2); elseif strcmp('~=',oper) y= ~mmisequal(f1,f2); elseif strcmp('<=',oper) y= mmislesseq(f1,f2); elseif strcmp('>=',oper) y= mmislesseq(f2,f1); elseif strcmp('>',oper) y= mmisequal(mmneg(mmthreshad(f2,f1)),logical(uint8(1))); elseif strcmp('<',oper) y= mmisequal(mmneg(mmthreshad(f1,f2)),logical(uint8(1))); else disp('Error: oper must be one of: ==, ~=, >, >=, <, <='); end if nargin == 5 if strcmp('==',oper1) y =y & mmisequal(f2,f3); elseif strcmp('~=',oper1) y= y & ~mmisequal(f2,f3); elseif strcmp('<=',oper1) y= y & mmislesseq(f2,f3); elseif strcmp('>=',oper1) y= y & mmislesseq(f3,f2); elseif strcmp('>',oper1) y= y & mmisequal(mmneg(mmthreshad(f3,f2)),logical(uint8(1))); elseif strcmp('<',oper1) y= y & mmisequal(mmneg(mmthreshad(f2,f3)),logical(uint8(1))); else disp('Error: oper1 must be one of: ==, ~=, >, >=, <, <='); end end elseif nargin==4 disp('Error: mmis requires 2,3 or 5 args'); else disp('Error: mmis requires 2, 3 or 5 args'); end % Copyright (c) 1998-2001 by SDC Information Systems.