[mmcwatershed] [Up] [mmswatershed] Thinning And Thickening

mmskiz
Skeleton of Influence Zone - also know as Generalized Voronoi Diagram

Synopsis

y = mmskiz( f, Bc = None, LINEREG = "LINES", METRIC = None )

Implemented in Python.

Input

f Image Binary image.
Bc Structuring Element

Connectivity for the distance measurement.

Default: None (3x3 elementary cross)

LINEREG String

'LINES' or 'REGIONS'.

Default: "LINES"

METRIC String

'EUCLIDEAN' if specified.

Default: None

Output

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

Description

mmskiz creates the image y by detecting the lines which are equidistant to two or more connected components of f, according to the connectivity defined by Bc. Depending on with the flag LINEREG, y will be a binary image with the skiz lines or a labeled image representing the zone of influence regions. When the connected objects of f are single points, the skiz is the Voronoi diagram.

Examples

Skiz:
>>> f=mmreadgray('blob2.tif')

              
>>> y=mmskiz(f,mmsebox(),'LINES','EUCLIDEAN')

              
>>> mmshow(f,y)

            
f,y
Voronoi diagram:
>>> from Numeric import zeros

              
>>> f=mmbinary(zeros((100,100)))

              
>>> f[30,25],f[20,75],f[50,50],f[70,30],f[80,70] = 1,1,1,1,1

              
>>> y = mmskiz(f,mmsebox(),'LINES','EUCLIDEAN')

              
>>> mmshow(f,y)

            
f,y

Limitations

For Euclidean metric, please see mmdist.

Source Code

def mmskiz(f, Bc=None, LINEREG="LINES", METRIC=None):
    from string import upper
    if Bc is None: Bc = mmsecross()
    LINEREG = upper(LINEREG)
    if METRIC is not None: METRIC = upper(METRIC)
    d = mmdist( mmneg(f), Bc, METRIC)
    return mmcwatershed(d,f,Bc,LINEREG)
    return y
    

See also

mmdist Distance transform.
mmcwatershed Detection of watershed from markers.
[mmcwatershed] [Up] [mmswatershed] Python