code.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Classes/Modules &#8212; image features extraction 1.0.0 documentation</title>
  7. <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '1.0.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true,
  16. SOURCELINK_SUFFIX: '.txt'
  17. };
  18. </script>
  19. <script type="text/javascript" src="_static/jquery.js"></script>
  20. <script type="text/javascript" src="_static/underscore.js"></script>
  21. <script type="text/javascript" src="_static/doctools.js"></script>
  22. <link rel="index" title="Index" href="genindex.html" />
  23. <link rel="search" title="Search" href="search.html" />
  24. <link rel="prev" title="Tutorial" href="tutorial.html" />
  25. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  26. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  27. </head>
  28. <body>
  29. <div class="document">
  30. <div class="documentwrapper">
  31. <div class="bodywrapper">
  32. <div class="body" role="main">
  33. <div class="section" id="classes-modules">
  34. <h1>Classes/Modules<a class="headerlink" href="#classes-modules" title="Permalink to this headline">¶</a></h1>
  35. <div class="section" id="module-Images">
  36. <span id="images"></span><h2>Images<a class="headerlink" href="#module-Images" title="Permalink to this headline">¶</a></h2>
  37. <dl class="class">
  38. <dt id="Images.Images">
  39. <em class="property">class </em><code class="descclassname">Images.</code><code class="descname">Images</code><span class="sig-paren">(</span><em>folder_name, image_file_ext=['tif', 'tiff']</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Images.html#Images"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Images.Images" title="Permalink to this definition">¶</a></dt>
  40. <dd><p>This class is used as collection of images which will be loaded from a given folder name</p>
  41. <dl class="method">
  42. <dt id="Images.Images.count">
  43. <code class="descname">count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Images.Images.count" title="Permalink to this definition">¶</a></dt>
  44. <dd></dd></dl>
  45. <dl class="method">
  46. <dt id="Images.Images.count_update">
  47. <code class="descname">count_update</code><span class="sig-paren">(</span><em>count</em><span class="sig-paren">)</span><a class="headerlink" href="#Images.Images.count_update" title="Permalink to this definition">¶</a></dt>
  48. <dd></dd></dl>
  49. <dl class="method">
  50. <dt id="Images.Images.item">
  51. <code class="descname">item</code><span class="sig-paren">(</span><em>i</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Images.html#Images.item"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Images.Images.item" title="Permalink to this definition">¶</a></dt>
  52. <dd><p>image item</p>
  53. </dd></dl>
  54. </dd></dl>
  55. </div>
  56. <div class="section" id="module-Image">
  57. <span id="image"></span><h2>Image<a class="headerlink" href="#module-Image" title="Permalink to this headline">¶</a></h2>
  58. <dl class="class">
  59. <dt id="Image.Image">
  60. <em class="property">class </em><code class="descclassname">Image.</code><code class="descname">Image</code><span class="sig-paren">(</span><em>full_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image" title="Permalink to this definition">¶</a></dt>
  61. <dd><p>Class image containing the single image obtained from the collection <a class="reference internal" href="#module-Images" title="Images"><code class="xref py py-class docutils literal"><span class="pre">Images</span></code></a></p>
  62. <table class="docutils field-list" frame="void" rules="none">
  63. <col class="field-name" />
  64. <col class="field-body" />
  65. <tbody valign="top">
  66. <tr class="field-odd field"><th class="field-name">Example:</th><td class="field-body"></td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  71. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  72. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  73. </pre></div>
  74. </div>
  75. <dl class="method">
  76. <dt id="Image.Image.file_name">
  77. <code class="descname">file_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.file_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.file_name" title="Permalink to this definition">¶</a></dt>
  78. <dd><p>file_name(…) return the full file name of the image</p>
  79. </dd></dl>
  80. <dl class="method">
  81. <dt id="Image.Image.regions">
  82. <code class="descname">regions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.regions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.regions" title="Permalink to this definition">¶</a></dt>
  83. <dd><p>regions(…) returns the Object Regions</p>
  84. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  85. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  86. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  87. <span class="gp">&gt;&gt;&gt; </span><span class="n">regs</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span>
  88. </pre></div>
  89. </div>
  90. </dd></dl>
  91. </dd></dl>
  92. </div>
  93. <div class="section" id="module-Regions">
  94. <span id="regions"></span><h2>Regions<a class="headerlink" href="#module-Regions" title="Permalink to this headline">¶</a></h2>
  95. <dl class="class">
  96. <dt id="Regions.Regions">
  97. <em class="property">class </em><code class="descclassname">Regions.</code><code class="descname">Regions</code><span class="sig-paren">(</span><em>obj_regions</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Regions.html#Regions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Regions.Regions" title="Permalink to this definition">¶</a></dt>
  98. <dd><p>This class represent a collection of regions: segmented image elements
  99. It cannot be instanced directly. It is returned from the object <a class="reference internal" href="#module-Image" title="Image"><code class="xref py py-class docutils literal"><span class="pre">Image</span></code></a> through the function
  100. Regions(…)</p>
  101. <table class="docutils field-list" frame="void" rules="none">
  102. <col class="field-name" />
  103. <col class="field-body" />
  104. <tbody valign="top">
  105. <tr class="field-odd field"><th class="field-name">Example:</th><td class="field-body"></td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  110. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  111. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  112. <span class="gp">&gt;&gt;&gt; </span><span class="n">regs</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span>
  113. </pre></div>
  114. </div>
  115. <dl class="method">
  116. <dt id="Regions.Regions.count">
  117. <code class="descname">count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Regions.Regions.count" title="Permalink to this definition">¶</a></dt>
  118. <dd></dd></dl>
  119. <dl class="method">
  120. <dt id="Regions.Regions.count_update">
  121. <code class="descname">count_update</code><span class="sig-paren">(</span><em>count</em><span class="sig-paren">)</span><a class="headerlink" href="#Regions.Regions.count_update" title="Permalink to this definition">¶</a></dt>
  122. <dd></dd></dl>
  123. <dl class="method">
  124. <dt id="Regions.Regions.get_features">
  125. <code class="descname">get_features</code><span class="sig-paren">(</span><em>features</em>, <em>class_value=None</em>, <em>class_name='class_name'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Regions.html#Regions.get_features"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Regions.Regions.get_features" title="Permalink to this definition">¶</a></dt>
  126. <dd><p>get_features(…) returns a table with all values for the property names given in input, and supplies an
  127. additional parameter for feature classification</p>
  128. <table class="docutils field-list" frame="void" rules="none">
  129. <col class="field-name" />
  130. <col class="field-body" />
  131. <tbody valign="top">
  132. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  133. <li><strong>features</strong> (<em>List</em>) – list of property/measure names (e.g, ‘area’, ‘centroid’, etc )</li>
  134. <li><strong>class_value</strong> (<em>int</em><em>, </em><em>string</em><em> (</em><em>default=None</em><em>)</em>) – classification label</li>
  135. </ul>
  136. </td>
  137. </tr>
  138. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">table cointaining all property values (columns) for all elements in the regions object (rows)</p>
  139. </td>
  140. </tr>
  141. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Pandas.DataFrame</p>
  142. </td>
  143. </tr>
  144. <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  149. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  150. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  151. <span class="gp">&gt;&gt;&gt; </span><span class="n">regs</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span>
  152. <span class="gp">&gt;&gt;&gt; </span><span class="n">df</span> <span class="o">=</span> <span class="n">regs</span><span class="o">.</span><span class="n">get_features</span><span class="p">([</span><span class="s1">&#39;label&#39;</span><span class="p">,</span> <span class="s1">&#39;area&#39;</span><span class="p">,</span><span class="s1">&#39;perimeter&#39;</span><span class="p">,</span> <span class="s1">&#39;centroid&#39;</span><span class="p">],</span> <span class="n">class_value</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
  153. </pre></div>
  154. </div>
  155. </dd></dl>
  156. <dl class="method">
  157. <dt id="Regions.Regions.item">
  158. <code class="descname">item</code><span class="sig-paren">(</span><em>i</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Regions.html#Regions.item"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Regions.Regions.item" title="Permalink to this definition">¶</a></dt>
  159. <dd><p>Item(..) returns the i-th image element of the regions.</p>
  160. <table class="docutils field-list" frame="void" rules="none">
  161. <col class="field-name" />
  162. <col class="field-body" />
  163. <tbody valign="top">
  164. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>i</strong> (<em>int</em>) – the i-th element of the collection region</td>
  165. </tr>
  166. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Region</td>
  167. </tr>
  168. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
  169. </tr>
  170. <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  175. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  176. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  177. <span class="gp">&gt;&gt;&gt; </span><span class="n">regs</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span>
  178. <span class="gp">&gt;&gt;&gt; </span><span class="n">reg</span> <span class="o">=</span> <span class="n">regs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  179. </pre></div>
  180. </div>
  181. </dd></dl>
  182. <dl class="method">
  183. <dt id="Regions.Regions.prop_values">
  184. <code class="descname">prop_values</code><span class="sig-paren">(</span><em>prop_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Regions.html#Regions.prop_values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Regions.Regions.prop_values" title="Permalink to this definition">¶</a></dt>
  185. <dd><p>prop_values(…) returns the values of the specified property/measure name (e.g., ‘area’) for all image
  186. elements contained in the object Regions. For a list of property names refer to “regionprops &lt;<a class="reference external" href="http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops">http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops</a>&gt;”_.</p>
  187. <table class="docutils field-list" frame="void" rules="none">
  188. <col class="field-name" />
  189. <col class="field-body" />
  190. <tbody valign="top">
  191. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>prop_name</strong> (<em>string</em>) – name of the property to measure (e.g, ‘area’)</td>
  192. </tr>
  193. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">values of the property name in input</td>
  194. </tr>
  195. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">List</td>
  196. </tr>
  197. <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
  202. <span class="gp">&gt;&gt;&gt; </span><span class="n">imgs</span> <span class="o">=</span> <span class="n">fe</span><span class="o">.</span><span class="n">Images</span><span class="p">(</span><span class="n">folder_name</span><span class="p">)</span>
  203. <span class="gp">&gt;&gt;&gt; </span><span class="n">img</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  204. <span class="gp">&gt;&gt;&gt; </span><span class="n">regs</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span>
  205. <span class="gp">&gt;&gt;&gt; </span><span class="n">areas</span> <span class="o">=</span> <span class="n">regs</span><span class="o">.</span><span class="n">prop_values</span><span class="p">(</span><span class="s1">&#39;area&#39;</span><span class="p">)</span>
  206. </pre></div>
  207. </div>
  208. </dd></dl>
  209. </dd></dl>
  210. </div>
  211. <div class="section" id="module-Region">
  212. <span id="region"></span><h2>Region<a class="headerlink" href="#module-Region" title="Permalink to this headline">¶</a></h2>
  213. <dl class="class">
  214. <dt id="Region.Region">
  215. <em class="property">class </em><code class="descclassname">Region.</code><code class="descname">Region</code><span class="sig-paren">(</span><em>obj_region</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Region.html#Region"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Region.Region" title="Permalink to this definition">¶</a></dt>
  216. <dd><dl class="method">
  217. <dt id="Region.Region.area">
  218. <code class="descname">area</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Region.html#Region.area"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Region.Region.area" title="Permalink to this definition">¶</a></dt>
  219. <dd></dd></dl>
  220. </dd></dl>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  227. <div class="sphinxsidebarwrapper">
  228. <h1 class="logo"><a href="index.html">image features extraction</a></h1>
  229. <h3>Navigation</h3>
  230. <p class="caption"><span class="caption-text">Contents:</span></p>
  231. <ul class="current">
  232. <li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
  233. <li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
  234. <li class="toctree-l1 current"><a class="current reference internal" href="#">Classes/Modules</a><ul>
  235. <li class="toctree-l2"><a class="reference internal" href="#module-Images">Images</a></li>
  236. <li class="toctree-l2"><a class="reference internal" href="#module-Image">Image</a></li>
  237. <li class="toctree-l2"><a class="reference internal" href="#module-Regions">Regions</a></li>
  238. <li class="toctree-l2"><a class="reference internal" href="#module-Region">Region</a></li>
  239. </ul>
  240. </li>
  241. </ul>
  242. <div class="relations">
  243. <h3>Related Topics</h3>
  244. <ul>
  245. <li><a href="index.html">Documentation overview</a><ul>
  246. <li>Previous: <a href="tutorial.html" title="previous chapter">Tutorial</a></li>
  247. </ul></li>
  248. </ul>
  249. </div>
  250. <div id="searchbox" style="display: none" role="search">
  251. <h3>Quick search</h3>
  252. <form class="search" action="search.html" method="get">
  253. <div><input type="text" name="q" /></div>
  254. <div><input type="submit" value="Go" /></div>
  255. <input type="hidden" name="check_keywords" value="yes" />
  256. <input type="hidden" name="area" value="default" />
  257. </form>
  258. </div>
  259. <script type="text/javascript">$('#searchbox').show(0);</script>
  260. </div>
  261. </div>
  262. <div class="clearer"></div>
  263. </div>
  264. <div class="footer">
  265. &copy;2017, Remigio Picone.
  266. |
  267. Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.3</a>
  268. &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
  269. |
  270. <a href="_sources/code.rst.txt"
  271. rel="nofollow">Page source</a>
  272. </div>
  273. </body>
  274. </html>