<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmadd4dil</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmvdome.html"><tt>mmvdome</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmpad4n.html"><tt>mmpad4n</tt></a>] </td> <td class="title">Python functions</td> </tr> </table> <h1>mmadd4dil <br> <span class="subtitle">Addition for dilation </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">a = <span class="fun">mmadd4dil</span>( <span class="par">f</span>, <span class="par">c</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> Gray-scale (uint8 or uint16) or binary image. <p>Image</p></td> </tr> <tr> <td class="term"><span class="par">c</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span> Gray-scale (uint8 or uint16) or binary image. <p>Constant</p></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">a</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span><p>f + c</p></td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmadd4dil(f, c): from Numeric import asarray, minimum, maximum if c: y = asarray(f,'d') + c k1,k2 = mmlimits(f) y = ((f==k1) * k1) + ((f!=k1) * y) y = maximum(minimum(y,k2),k1) a = y.astype(f.typecode()) else: a = f return a </pre> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/mmvdome.html"><tt>mmvdome</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmpad4n.html"><tt>mmpad4n</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>