[mminterot] [Up] [mmse2interval] Intervals (hit-or-miss templates)

mmintershow
Visualize an interval.

Synopsis

s = mmintershow( Iab )

Implemented in Python.

Input

Iab Interval

Output

s String

( representation of the interval).

Description

mmintershow creates a representation for an interval using 0, 1 and . ( don't care).

Examples

>>> print mmintershow(mmhomothin())
0 0 0 
. 1 . 
1 1 1

Source Code

def mmintershow(Iab):
    from Numeric import array, product, reshape, choose
    from string import join
    assert (type(Iab) is tuple) and (len(Iab) == 2),'not proper fortmat of hit-or-miss template'
    A,Bc = Iab
    S = mmseunion(A,Bc)
    Z = mmintersec(S,0)
    n = product(S.shape)
    one  = reshape(array(n*'1','c'),S.shape)
    zero = reshape(array(n*'0','c'),S.shape)
    x    = reshape(array(n*'.','c'),S.shape)
    saux = choose( S + mmseunion(Z,A), ( x, zero, one))
    s = ''
    for i in range(saux.shape[0]):
        s=s+(join(list(saux[i]))+' \n')
    return s
    

See also

mmfreedom Control automatic data type conversion.
mmendpoints Interval to detect end-points.
mmhomothick Interval for homotopic thickening.
mmhomothin Interval for homotopic thinning.
mmse2hmt Create a Hit-or-Miss Template (or interval) from a pair of structuring elements.
[mminterot] [Up] [mmse2interval] Python