<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmisbinary</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmis.html"><tt>mmis</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmisequal.html"><tt>mmisequal</tt></a>] </td> <td class="title">Relations</td> </tr> </table> <h1>mmisbinary <br> <span class="subtitle">Check for binary image </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">bool = <span class="fun">mmisbinary</span>( <span class="par">f</span> ) </div> <p>Implemented in <b>Python.</b> </p> <div class="input"> <H3>Input</H3> <div class="H3"> <table class="deflist"> <tbody valign="baseline"> <tr> <td class="term"><span class="par">f</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span></td> </tr> </tbody> </table> </div> </div> <div class="output"> <H3>Output</H3> <div class="H3"> <table class="deflist"> <tbody valign="baseline"> <tr> <td class="term"><span class="par">bool</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmBoolean.html">Boolean</a></span></td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="descr"> <H2>Description</H2> <div class="H2"> <p> <span class="fun">mmisbinary</span> returns <code>TRUE(1)</code> if the datatype of the input image is binary. A binary image has just the values 0 and 1. </p> </div> </div> <div class="examples"> <H2>Examples</H2> <div class="H2"> <p> <div class="example"> <div class="listing"> <pre class="user">>>> a=uint8([0, 1, 0, 1])</pre> <pre class="computer"></pre> <pre class="user">>>> print mmisbinary(a)</pre> <pre class="computer">0.0</pre> <pre class="user">>>> b=(a)</pre> <pre class="computer"></pre> <pre class="user">>>> print mmisbinary(b)</pre> <pre class="computer">0.0</pre> </div> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmisbinary(f): bool = type(f) is type(mmbinary([1])) if bool: bool = f.typecode() == '1' return bool </pre> </div> </div> <div class="seealso"> <H2>See also</H2> <div class="H2"> <table class="deflist"> <tbody valign="baseline"> <tr> <td class="term"><a href="../morph/mmfreedom.html">mmfreedom</a></td> <td class="def">Control automatic data type conversion.</td> </tr> <tr> <td class="term"><a href="../morph/mmbinary.html">mmbinary</a></td> <td class="def">Convert a gray-scale image into a binary image</td> </tr> <tr> <td class="term"><a href="../morph/mmgray.html">mmgray</a></td> <td class="def">Convert a binary image into a gray-scale image.</td> </tr> <tr> <td class="term"><a href="../morph/mmis.html">mmis</a></td> <td class="def">Verify if a relationship among images is true or false.</td> </tr> </tbody> </table> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/mmis.html"><tt>mmis</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmisequal.html"><tt>mmisequal</tt></a>] </td> <td rowspan="2" class="xhtml"><a href="http://www.python.org"><img width="55" alt="Python" height="22" src="../PythonPoweredSmall.gif"></a></td> </tr> <tr> <td class="copyright">Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.</td> </tr> </table> </center> </body> </html>