<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmswatershed</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmskiz.html"><tt>mmskiz</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmthick.html"><tt>mmthick</tt></a>] </td> <td class="title">Thinning And Thickening</td> </tr> </table> <h1>mmswatershed <br> <span class="subtitle">Detection of similarity-based watershed from markers. </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">y = <span class="fun">mmswatershed</span>( <span class="par">f</span>, <span class="par">g</span>, <span class="par">B</span> = None, <span class="par">LINEREG</span> = "LINES" ) </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) image. </td> </tr> <tr> <td class="term"><span class="par">g</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>Marker image. If binary, each connected component is an object marker. If gray, it is assumed it is a labeled image.</p></td> </tr> <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><p>(watershed connectivity)</p><p>Default: <code>None</code> (3x3 elementary cross) </p></td> </tr> <tr> <td class="term"><span class="par">LINEREG</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmString.html">String</a></span><p>'LINES' or ' REGIONS'.</p><p>Default: <code>"LINES"</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">mmswatershed</span> creates the image <code>y</code> by detecting the domain of the catchment basins of <code>f</code> indicated by <code>g</code>, according with the connectivity defined by <code>B</code>. This watershed is a modified version where each basin is defined by a similarity criterion between pixels. The original watershed is normally applied to the gradient of the image. In this case, the gradient is taken internally. According to the flag LINEREG <code>y</code> will be a labeled image of the catchment basins domain or just a binary image that presents the watershed lines. The implementation of this function is based on LotuFalc:00. </p> </div> </div> <div class="examples"> <H2>Examples</H2> <div class="H2"> <p> <div class="bridge">Numerical</div> <div class="example"> <div class="listing"> <pre class="user">>>> f = uint8([ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]])</pre> <pre class="computer"></pre> <pre class="user">>>> m = uint8([ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0]])</pre> <pre class="computer"></pre> <pre class="user">>>> print mmswatershed(f,m,mmsecross(),'REGIONS')</pre> <pre class="computer">[[2 2 2 2 2 2 2] [2 1 2 2 2 1 2] [2 1 2 2 2 1 2] [2 1 1 1 1 1 2] [2 1 2 2 2 2 2] [2 2 2 2 2 2 2]]</pre> </div> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmswatershed(f, g, B=None, LINEREG="LINES"): if B is None: B = mmsecross() print 'Not implemented yet' return None 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/mmcwatershed.html">mmcwatershed</a></td> <td class="def">Detection of watershed from markers.</td> </tr> <tr> <td class="term"><a href="../morph/mmwatershed.html">mmwatershed</a></td> <td class="def">Watershed detection.</td> </tr> <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/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> </tbody> </table> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/mmskiz.html"><tt>mmskiz</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmthick.html"><tt>mmthick</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>