Sophie

Sophie

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

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

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmis</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../morph/mmcmp.html"><tt>mmcmp</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../morph/mmisbinary.html"><tt>mmisbinary</tt></a>]
              </td>
        <td class="title">Relations</td>
      </tr>
    </table>
    <h1>mmis
      <br>
      <span class="subtitle">Verify if a relationship among images is true or false.
</span>
    </h1>
    <div class="synopsis">
      <H2>Synopsis</H2>
      <div class="H2">
        <div class="prototype">y = 
          <span class="fun">mmis</span>(
                  
          <span class="par">f1</span>, 
          <span class="par">oper</span>, 
          <span class="par">f2</span> = None, 
          <span class="par">oper1</span> = None, 
          <span class="par">f3</span> = None
                  )
        </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">f1</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>
                <tr>
                  <td class="term"><span class="par">oper</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmString.html">String</a></span><p>relationship from: '==', '~=', '&lt;','&lt;=', '&gt;', '&gt;=', 'binary', 'gray'.</p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">f2</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>Default: 
                      <code>None</code>
                    </p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">oper1</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmString.html">String</a></span><p>relationship from: '==', '~=', '&lt;','&lt;=', '&gt;', '&gt;='.</p><p>Default: 
                      <code>None</code>
                    </p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">f3</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>Default: 
                      <code>None</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/mmDouble.html">Double</a></span><p>Bool value: 0 or 1</p></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="descr">
      <H2>Description</H2>
      <div class="H2">
        <p>
                      Verify if the property or relatioship between images is true or false. The result is true if the relationship is true for all the pixels in the image, and false otherwise. (Obs: This function replaces 
          <code><span class="fun">mmis</span>equal, <span class="fun">mmis</span>lesseq, <span class="fun">mmis</span>binary</code>).
                  
        </p>
      </div>
    </div>
    <div class="examples">
      <H2>Examples</H2>
      <div class="H2">
        <p>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; fbin=mmbinary([0, 1])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; f1=uint8([1, 2, 3])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; f2=uint8([2, 2, 3])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; f3=uint8([2, 3, 4])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmis(fbin,'binary')</pre>
              <pre class="computer">1.0</pre>
              <pre class="user">&gt;&gt;&gt; mmis(f1,'gray')</pre>
              <pre class="computer">1</pre>
              <pre class="user">&gt;&gt;&gt; mmis(f1,'==',f2)</pre>
              <pre class="computer">0.0</pre>
              <pre class="user">&gt;&gt;&gt; mmis(f1,'&lt;',f3)</pre>
              <pre class="computer">1.0</pre>
              <pre class="user">&gt;&gt;&gt; mmis(f1,'&lt;=',f2)</pre>
              <pre class="computer">1.0</pre>
              <pre class="user">&gt;&gt;&gt; mmis(f1,'&lt;=',f2,'&lt;=',f3)
            </pre>
              <pre class="computer">1.0</pre>
            </div>
          </div>
        </p>
      </div>
    </div>
    <div class="sourcecode">
      <H2>Source Code</H2>
      <div class="H2">
        <pre class="listing">
def mmis(f1, oper, f2=None, oper1=None, f3=None):
    from string import upper
    if f2 == None:
        oper=upper(oper);
        if   oper == 'BINARY': return mmisbinary(f1)
        elif oper == 'GRAY'  : return not mmisbinary(f1)
        else:
            assert 0,'oper should be BINARY or GRAY, was'+oper
    elif oper == '==':    y = mmisequal(f1, f2)
    elif oper == '~=':    y = not mmisequal(f1,f2)
    elif oper == '&lt;=':    y = mmislesseq(f1,f2)
    elif oper == '&gt;=':    y = mmislesseq(f2,f1)
    elif oper == '&gt;':     y = mmisequal(mmneg(mmthreshad(f2,f1)),mmbinary(1))
    elif oper == '&lt;':     y = mmisequal(mmneg(mmthreshad(f1,f2)),mmbinary(1))
    else:
        assert 0,'oper must be one of: ==, ~=, &gt;, &gt;=, &lt;, &lt;=, it was:'+oper
    if oper1 != None:
        if   oper1 == '==': y = y and mmisequal(f2,f3)
        elif oper1 == '~=': y = y and (not mmisequal(f2,f3))
        elif oper1 == '&lt;=': y = y and mmislesseq(f2,f3)
        elif oper1 == '&gt;=': y = y and mmislesseq(f3,f2)
        elif oper1 == '&gt;':  y = y and mmisequal(mmneg(mmthreshad(f3,f2)),mmbinary(1))
        elif oper1 == '&lt;':  y = y and mmisequal(mmneg(mmthreshad(f2,f3)),mmbinary(1))
        else:
            assert 0,'oper1 must be one of: ==, ~=, &gt;, &gt;=, &lt;, &lt;=, it was:'+oper1
    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/mmcmp.html">mmcmp</a></td>
              <td class="def">Compare two images pixelwisely.</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/mmbinary.html">mmbinary</a></td>
              <td class="def">Convert a gray-scale image into a binary image</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmgray.html">mmgray</a></td>
              <td class="def">Convert a binary image into a gray-scale image.</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../morph/mmcmp.html"><tt>mmcmp</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../morph/mmisbinary.html"><tt>mmisbinary</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>