[mmdtshow] [Up] [mmshow] Visualization

mmlblshow
Display a labeled image assigning a random color for each label.

Synopsis

y = mmlblshow( f, option = 'noborder' )

Implemented in Python.

Input

f Image 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 Image Gray-scale (uint8 or uint16) or binary image.

Optionally return RGB uint8 image

Description

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')

            
f1 f1 f1,'border'

Source Code

def mmlblshow(f, option='noborder'):
    import string
    import adpil
    if (mmisbinary(f)) or (len(f.shape) != 2):
      print 'Error, mmlblshow: works only for grayscale labeled image'
      return
    option = string.upper(option);
    if option == 'NOBORDER':
      border = 0.0;
    elif option == 'BORDER':
      border = 1.0;
    else:
      print 'Error: option must be BORDER or NOBORDER'
    y=mmglblshow(f, border);
    adpil.adshow(y)
    return
    return y
    

See also

mmlabel Label a binary image.
mmlblshow Display a labeled image assigning a random color for each label.
mmshow Display binary or gray-scale images and optionally overlay it with binary images.
[mmdtshow] [Up] [mmshow] Python