[iadftview] [Up] [iaplot] Visualization

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

Synopsis

g = ialblshow( f )

Implemented in Python.

Input

f Image. Gray-scale (uint8 or uint16) or binary image (logical).

input image

Output

g Image. Accepts any image data type.

Description

Displays the labeled input image (uint8 or uint16) with a pseudo color where each label appears with a random color.

Examples

>>> f = iaread('blobs.pbm')

              
>>> g = ialabel(f);

              
>>> iashow(g)
(128, 128) Min= 0 Max= 18 Mean=4.940 Std=6.23
>>> iashow(ialblshow(g))
(3, 128, 128) Min= 0.0 Max= 254.0 Mean=62.281 Std=83.79
g ialblshow(g)

Source Code

def ialblshow(f):
    from Numeric import ravel, floor, concatenate
    from MLab import rand
    nblobs = max(ravel(f))
    r = floor(0.5 + 255*rand(nblobs, 1))
    g = floor(0.5 + 255*rand(nblobs, 1))
    b = floor(0.5 + 255*rand(nblobs, 1))
    ct = concatenate((r,g,b), 1)
    ct = concatenate(([[0,0,0]], ct))
    g = iaapplylut(f, ct)
    return g
    
[iadftview] [Up] [iaplot] http://www.python.org