[mmis] [Up] [mmisequal] Relations

mmisbinary
Check for binary image

Synopsis

bool = mmisbinary( f )

Implemented in Python.

Input

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

Output

bool Boolean

Description

mmisbinary returns TRUE(1) if the input image is binary. A binary image is a logical uint8 image that has just the values 0 and 1.

Examples

>>> a=uint8([0, 1, 0, 1])

              
>>> mmisbinary(a)
0.0
>>> b=(a)

              
>>> mmisbinary(b)
            
0.0

Source Code

def mmisbinary(f):
    bool = type(f) is type(mmbinary([1]))
    if bool:            
       bool = f.typecode() == '1'
    return bool
    

See also

mmfreedom Control automatic data type conversion.
mmbinary Convert a gray-scale image into a binary image
mmgray Convert a binary image into a gray-scale image.
mmis Verify if a relationship among images is true or false.
[mmis] [Up] [mmisequal] Python