Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4a71d9984febeb5a206904a5a379841a > files > 688

python-morph-0.8-7mdv2010.0.noarch.rpm

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmglblshow</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../morph/mmstats.html"><tt>mmstats</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../morph/mmgshow.html"><tt>mmgshow</tt></a>]
              </td>
        <td class="title">Visualization</td>
      </tr>
    </table>
    <h1>mmglblshow
      <br>
      <span class="subtitle">Apply a random color table to a gray-scale image.
</span>
    </h1>
    <div class="synopsis">
      <H2>Synopsis</H2>
      <div class="H2">
        <div class="prototype">Y = 
          <span class="fun">mmglblshow</span>(
                  
          <span class="par">X</span>, 
          <span class="par">border</span> = 0.0
                  )
        </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">X</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span>          Gray-scale (uint8 or uint16) image.
                          <p>Labeled image.</p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">border</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmBoolean.html">Boolean</a></span><p>Labeled image.</p><p>Default: 
                      <code>0.0</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="sourcecode">
      <H2>Source Code</H2>
      <div class="H2">
        <pre class="listing">
def mmglblshow(X, border=0.0):
    from Numeric import take, resize, shape
    from MLab import rand
    mmin = mmstats(X,'min')
    mmax = mmstats(X,'max')
    ncolors = mmax - mmin + 1
    R = int32(rand(ncolors)*255)
    G = int32(rand(ncolors)*255)
    B = int32(rand(ncolors)*255)
    if mmin == 0:
       R[0],G[0],B[0] = 0,0,0
    r=resize(take(R, X.flat - mmin),X.shape)
    g=resize(take(G, X.flat - mmin),X.shape)
    b=resize(take(B, X.flat - mmin),X.shape)
    Y=mmconcat('d',r,g,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/mmlabel.html">mmlabel</a></td>
              <td class="def">Label a binary image.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmlblshow.html">mmlblshow</a></td>
              <td class="def">Display a labeled image assigning a random color for each label.</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../morph/mmstats.html"><tt>mmstats</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../morph/mmgshow.html"><tt>mmgshow</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>