<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmseshow</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmserot.html"><tt>mmserot</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmsesum.html"><tt>mmsesum</tt></a>] </td> <td class="title">Structuring Elements</td> </tr> </table> <h1>mmseshow <br> <span class="subtitle">Display a structuring element as an image. </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">y = <span class="fun">mmseshow</span>( <span class="par">B</span>, <span class="par">option</span> = "NORMAL" ) </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">B</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmSe.html">Structuring Element</a></span></td> </tr> <tr> <td class="term"><span class="par">option</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmString.html">String</a></span><p>'NORMAL', ' EXPAND' or ' NON-FLAT'</p><p>Default: <code>"NORMAL"</code> </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">y</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span> Gray-scale (uint8 or uint16) or binary image. </td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="descr"> <H2>Description</H2> <div class="H2"> <p> <span class="fun">mmseshow</span> used with the option EXPAND generates an image <code>y</code> that is a suitable graphical representation of the structuring element <code>B</code>. This function is useful to convert a structuring element to an image. The origin of the structuring element is at the center of the image. If <code>B</code> is flat, <code>y</code> is binary, otherwise, <code>y</code> is signed int32 image. When using the option NON-FLAT, the output <code>y</code> is always a signed int32 image. </p> </div> </div> <div class="examples"> <H2>Examples</H2> <div class="H2"> <p> <div class="bridge">Flat structuring element</div> <div class="example"> <div class="listing"> <pre class="user">>>> b=mmsecross(3);</pre> <pre class="computer"></pre> <pre class="user">>>> print mmseshow(b)</pre> <pre class="computer">[[0 0 0 1 0 0 0] [0 0 1 1 1 0 0] [0 1 1 1 1 1 0] [1 1 1 1 1 1 1] [0 1 1 1 1 1 0] [0 0 1 1 1 0 0] [0 0 0 1 0 0 0]]</pre> <pre class="user">>>> a = mmseshow(b,'EXPAND')</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(a)</pre> <pre class="computer"></pre> <pre class="user">>>> print mmseshow(b,'NON-FLAT')</pre> <pre class="computer">[[-2147483647 -2147483647 -2147483647 0 -2147483647 -2147483647 -2147483647] [-2147483647 -2147483647 0 0 0 -2147483647 -2147483647] [-2147483647 0 0 0 0 0 -2147483647] [ 0 0 0 0 0 0 0] [-2147483647 0 0 0 0 0 -2147483647] [-2147483647 -2147483647 0 0 0 -2147483647 -2147483647] [-2147483647 -2147483647 -2147483647 0 -2147483647 -2147483647 -2147483647]]</pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="119" src="../images/img_mmseshow_001.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmseshow_001.jpg">a</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> <div class="bridge">Non flat structuring element</div> <div class="example"> <div class="listing"> <pre class="user">>>> b=mmsedisk(2,'2D','EUCLIDEAN','NON-FLAT')</pre> <pre class="computer"></pre> <pre class="user">>>> print mmseshow(b)</pre> <pre class="computer">[[-2147483647 1 1 1 -2147483647] [ 1 2 2 2 1] [ 1 2 2 2 1] [ 1 2 2 2 1] [-2147483647 1 1 1 -2147483647]]</pre> </div> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmseshow(B, option="NORMAL"): from string import upper option = upper(option) if option=='NON-FLAT': y=int32([0]) if mmisbinary(B): B = mmintersec(mmgray(B,'int32'),0) elif option=='NORMAL': if mmisbinary(B): y=mmbinary([1]) else: y=int32([0]) elif option=='EXPAND': assert mmisbinary(B), 'This option is only available with flat SE' y = mmsedil(mmbinary([1]),B) b1= mmbinary(y>=0) b0= mmero(y,B) y = mmbshow(b1,y,b0) return y else: print 'mmseshow: not a valid flag: NORMAL, EXPAND or NON-FLAT' y = mmsedil(y,B) return y </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/mmimg2se.html">mmimg2se</a></td> <td class="def">Create a structuring element from a pair of images.</td> </tr> <tr> <td class="term"><a href="../morph/mmsebox.html">mmsebox</a></td> <td class="def">Create a box structuring element.</td> </tr> <tr> <td class="term"><a href="../morph/mmsecross.html">mmsecross</a></td> <td class="def">Diamond structuring element and elementary 3x3 cross.</td> </tr> <tr> <td class="term"><a href="../morph/mmsedisk.html">mmsedisk</a></td> <td class="def">Create a disk or a semi-sphere structuring element.</td> </tr> <tr> <td class="term"><a href="../morph/mmseline.html">mmseline</a></td> <td class="def">Create a line structuring element.</td> </tr> </tbody> </table> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/mmserot.html"><tt>mmserot</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmsesum.html"><tt>mmsesum</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>