function y = mmlblshow( f, option ) % MMLBLSHOW Display a labeled image assigning a random color for each label. % % Y = MMLBLSHOW( F, OPTION ) % % Input: % F - Gray-scale (uint8 or uint16) image. Labeled image. % OPTION - String. BORDER or NOBORDER: includes or not a white % border around each labeled region DEFAULT: 'noborder'. % % Output: % Y - Gray-scale (uint8 or uint16) or binary image (logical uint8). % Optionally return RGB uint8 image % % Displays the labeled image F (uint8 or uint16) with a pseudo color % where each label appears with a random color. The image is % displayed in the MATLAB figure only if no output parameter is % given. % % Examples % -------- % % f=mmreadgray('blob3.tif'); % f1=mmlabel(f,mmsebox); % mmshow(f1); % mmlblshow(f1); % mmlblshow(f1,'border'); % % % See also MMLABEL, MMLBLSHOW, MMSHOW, MMSURF. % begin of the default argument automatic treatment if ~exist('option','var') option = 'noborder'; end % end of the default argument automatic treatment 1 if (nargin < 1) disp('Error, mmlblshow: needs one input image.'); return; end if (mmisbinary(f)) disp('Error, mmlblshow: works only for grayscale labeled image'); return; end option = upper(option); if strcmp (option, 'NOBORDER') border = 0.0; elseif strcmp( option, 'BORDER') border = 1.0; else disp('Error: option must be BORDER or NOBORDER'); end y=mmglblshow(f, border); if nargout == 0 newFigure=isempty(get(0,'CurrentFigure')) | strcmp(get(get(0,'CurrentFigure'), 'NextPlot'), 'new'); if (newFigure) figHandle = figure('Visible', 'off'); axHandle = axes('Parent', figHandle); else axHandle = newplot; figHandle = get(axHandle, 'Parent'); end image(y,'Parent',axHandle); axis off; colormap(gray); set(axHandle,'DataAspectRatio',[1 1 1]); if (length(findobj(axHandle,'Type','image')) <= 1) figKids=allchild(figHandle); kids=[findobj(figKids,'Type','axes') ; findobj(figKids,'Type','uicontrol','Visible','on')]; if (length(kids) <= 1) if (isequal(get(axHandle,'Position'),get(get(axHandle,'Parent'),'DefaultAxesPosition'))) mmtruesize(f); % change the figure size to reflect image size set(figHandle,'NextPlot','replacechildren'); end end end figure(gcf); end % Copyright (c) 1998-2001 by SDC Information Systems.