<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>uint16</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/uint8.html"><tt>uint8</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmframe.html"><tt>mmframe</tt></a>] </td> <td class="title">Data Type Conversion</td> </tr> </table> <h1>uint16 <br> <span class="subtitle">Convert an image to a uint16 image. </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">img = <span class="fun">uint16</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><p>Any image</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">img</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span><p>The converted image</p></td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="descr"> <H2>Description</H2> <div class="H2"> <p> <span class="fun">uint16</span> clips the input image between the values 0 and 65535 and converts it to the unsigned 16-bit datatype. </p> </div> </div> <div class="examples"> <H2>Examples</H2> <div class="H2"> <p> <div class="example"> <div class="listing"> <pre class="user">>>> a = int32([-3,0,8,100000])</pre> <pre class="computer"></pre> <pre class="user">>>> print uint16(a)</pre> <pre class="computer">[ 0 0 8 65535]</pre> </div> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def uint16(f): from Numeric import array, clip img = array(clip(f,0,65535)).astype('w') return img </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/int32.html">int32</a></td> <td class="def">Convert an image to an int32 image.</td> </tr> <tr> <td class="term"><a href="../morph/uint8.html">uint8</a></td> <td class="def">Convert an image to an uint8 image.</td> </tr> <tr> <td class="term"><a href="../morph/mmdatatype.html">mmdatatype</a></td> <td class="def">Return the image datatype string</td> </tr> </tbody> </table> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/uint8.html"><tt>uint8</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmframe.html"><tt>mmframe</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>