12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Classes/Modules — Image Features Extraction 1.0.0 documentation</title>
- <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: './',
- VERSION: '1.0.0',
- COLLAPSE_INDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true,
- SOURCELINK_SUFFIX: '.txt'
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="prev" title="Tutorial" href="tutorial.html" />
-
- <link rel="stylesheet" href="_static/custom.css" type="text/css" />
-
-
- <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
- </head>
- <body>
-
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body" role="main">
-
- <div class="section" id="classes-modules">
- <h1>Classes/Modules<a class="headerlink" href="#classes-modules" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="module-Images">
- <span id="images"></span><h2>Images<a class="headerlink" href="#module-Images" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="Images.Images">
- <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>
- <dd><p>This class loads a collection of images for extraction of features</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>folder_name</strong> (<em>List of strings</em>) – folder containing images</li>
- <li><strong>image_file_ext</strong> – images file extensions (default=[‘tif’,’tiff’])</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">an instance of the object Images</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">object</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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="s1">'my_folder'</span><span class="p">,</span> <span class="n">image_file_ext</span><span class="o">=</span><span class="p">[</span><span class="s1">'tif'</span><span class="p">,</span><span class="s1">'tiff'</span><span class="p">,</span><span class="s1">'jpeg'</span><span class="p">])</span>
- <span class="gp">>>> </span><span class="n">num_images</span> <span class="o">=</span> <span class="n">imgs</span><span class="o">.</span><span class="n">count</span><span class="p">()</span>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="Images.Images.count">
- <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>
- <dd><p>returns the number of items</p>
- </dd></dl>
- <dl class="method">
- <dt id="Images.Images.count_update">
- <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>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Images.Images.item">
- <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>
- <dd><p>returns the i-th image</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>i</strong> (<em>int</em>) – the i-th image</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#module-Image" title="Image"><code class="xref py py-class docutils literal"><span class="pre">Image</span></code></a></td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- </pre></div>
- </div>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="module-Image">
- <span id="image"></span><h2>Image<a class="headerlink" href="#module-Image" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="Image.Image">
- <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>
- <dd><p>This class instantiate an object Image through the <a class="reference internal" href="#module-Images" title="Images"><code class="xref py py-class docutils literal"><span class="pre">Images</span></code></a> and refers to a specific file image</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="Image.Image.Voronoi">
- <code class="descname">Voronoi</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.Voronoi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.Voronoi" title="Permalink to this definition">¶</a></dt>
- <dd><p>Image Voronoi diagram (refer to documentaiton of my package Voronoi_Features in my github )</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Voronoi object for the current image</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">Voronoi object</td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
- <span class="go">>>></span>
- <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="go">>>></span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="go">>>></span>
- <span class="gp">>>> </span><span class="n">voro</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Voronoi</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="c1"># show voronoi diagram</span>
- <span class="gp">>>> </span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">plt</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">vor</span><span class="o">.</span><span class="n">get_voronoi_map</span><span class="p">(),</span> <span class="n">cmap</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">get_cmap</span><span class="p">(</span><span class="s1">'jet'</span><span class="p">))</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.features">
- <code class="descname">features</code><span class="sig-paren">(</span><em>features_list</em>, <em>prefix=''</em>, <em>suffix=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.features"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.features" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns a table with all values for the property names given in input, and supplies an
- additional parameter for feature classification</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>features_list</strong> (<em>List</em>) – list of property/measure names (e.g, ‘area’, ‘centroid’, etc )</li>
- <li><strong>prefix</strong> (<em>string</em>) – prefix for features name</li>
- <li><strong>suffix</strong> (<em>string</em>) – prefix for features name</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Features Object</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Features Object</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </span><span class="n">feature</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">get_features</span><span class="p">([</span><span class="s1">'label'</span><span class="p">,</span> <span class="s1">'area'</span><span class="p">,</span><span class="s1">'perimeter'</span><span class="p">,</span> <span class="s1">'centroid'</span><span class="p">])</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.file_name">
- <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>
- <dd><p>full file name of the image</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">file name</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.get_image_segmentation">
- <code class="descname">get_image_segmentation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.get_image_segmentation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.get_image_segmentation" title="Permalink to this definition">¶</a></dt>
- <dd><p>Builds the image with mask overlay to show the segmentation</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The image in RGB format, in a 3-D array of shape (.., .., 3).</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">ndarray</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.height">
- <code class="descname">height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.height" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Image.Image.prop_values">
- <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/Image.html#Image.prop_values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.prop_values" title="Permalink to this definition">¶</a></dt>
- <dd><p>Measure the values of the specified property/measure name (e.g., ‘area’) for all
- elements contained in the object Regions.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">property name values</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">List</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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">'area'</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>The following properties can be accessed as attributes or keys:</p>
- <dl class="docutils">
- <dt><strong>area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of region.</dd>
- <dt><strong>bbox</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Bounding box <code class="docutils literal"><span class="pre">(min_row,</span> <span class="pre">min_col,</span> <span class="pre">max_row,</span> <span class="pre">max_col)</span></code>.
- Pixels belonging to the bounding box are in the half-open interval
- <code class="docutils literal"><span class="pre">[min_row;</span> <span class="pre">max_row)</span></code> and <code class="docutils literal"><span class="pre">[min_col;</span> <span class="pre">max_col)</span></code>.</dd>
- <dt><strong>bbox_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of bounding box.</dd>
- <dt><strong>centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>.</dd>
- <dt><strong>convex_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of convex hull image.</dd>
- <dt><strong>convex_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary convex hull image which has the same size as bounding box.</dd>
- <dt><strong>coords</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(N, 2) ndarray</span></dt>
- <dd>Coordinate list <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> of the region.</dd>
- <dt><strong>eccentricity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Eccentricity of the ellipse that has the same second-moments as the
- region. The eccentricity is the ratio of the focal distance
- (distance between focal points) over the major axis length.
- The value is in the interval [0, 1).
- When it is 0, the ellipse becomes a circle.</dd>
- <dt><strong>equivalent_diameter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The diameter of a circle with the same area as the region.</dd>
- <dt><strong>euler_number</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Euler characteristic of region. Computed as number of objects (= 1)
- subtracted by number of holes (8-connectivity).</dd>
- <dt><strong>extent</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels in the total bounding box.
- Computed as <code class="docutils literal"><span class="pre">area</span> <span class="pre">/</span> <span class="pre">(rows</span> <span class="pre">*</span> <span class="pre">cols)</span></code></dd>
- <dt><strong>filled_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of filled region.</dd>
- <dt><strong>filled_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary region image with filled holes which has the same size as
- bounding box.</dd>
- <dt><strong>image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Sliced binary region image which has the same size as bounding box.</dd>
- <dt><strong>inertia_tensor</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(2, 2) ndarray</span></dt>
- <dd>Inertia tensor of the region for the rotation around its mass.</dd>
- <dt><strong>inertia_tensor_eigvals</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>The two eigen values of the inertia tensor in decreasing order.</dd>
- <dt><strong>intensity_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">ndarray</span></dt>
- <dd>Image inside region bounding box.</dd>
- <dt><strong>label</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>The label in the labeled input image.</dd>
- <dt><strong>local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box.</dd>
- <dt><strong>major_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the major axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>max_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the greatest intensity in the region.</dd>
- <dt><strong>mean_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the mean intensity in the region.</dd>
- <dt><strong>min_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the least intensity in the region.</dd>
- <dt><strong>minor_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the minor axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments up to 3rd order::</dt>
- <dd>m_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Central moments (translation invariant) up to 3rd order::</dt>
- <dd>mu_ji = sum{ array(x, y) * (x - x_c)^j * (y - y_c)^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s centroid.</p>
- </dd>
- <dt><strong>moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant).</dd>
- <dt><strong>moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Normalized moments (translation and scale invariant) up to 3rd order::</dt>
- <dd>nu_ji = mu_ji / m_00^[(i+j)/2 + 1]</dd>
- </dl>
- <p class="last">where <cite>m_00</cite> is the zeroth spatial moment.</p>
- </dd>
- <dt><strong>orientation</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Angle between the X-axis and the major axis of the ellipse that has
- the same second-moments as the region. Ranging from <cite>-pi/2</cite> to
- <cite>pi/2</cite> in counter-clockwise direction.</dd>
- <dt><strong>perimeter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Perimeter of object which approximates the contour as a line
- through the centers of border pixels using a 4-connectivity.</dd>
- <dt><strong>solidity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels of the convex hull image.</dd>
- <dt><strong>weighted_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> weighted with intensity
- image.</dd>
- <dt><strong>weighted_local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box, weighted with intensity image.</dd>
- <dt><strong>weighted_moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments of intensity image up to 3rd order::</dt>
- <dd>wm_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>weighted_moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Central moments (translation invariant) of intensity image up to
- 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wmu_ji</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">{</span> <span class="n">array</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_c</span><span class="p">)</span><span class="o">^</span><span class="n">j</span> <span class="o">*</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">y_c</span><span class="p">)</span><span class="o">^</span><span class="n">i</span> <span class="p">}</span>
- </pre></div>
- </div>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s weighted
- centroid.</p>
- </dd>
- <dt><strong>weighted_moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant) of intensity
- image.</dd>
- <dt><strong>weighted_moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Normalized moments (translation and scale invariant) of intensity
- image up to 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wnu_ji</span> <span class="o">=</span> <span class="n">wmu_ji</span> <span class="o">/</span> <span class="n">wm_00</span><span class="o">^</span><span class="p">[(</span><span class="n">i</span><span class="o">+</span><span class="n">j</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span>
- </pre></div>
- </div>
- <p class="last">where <code class="docutils literal"><span class="pre">wm_00</span></code> is the zeroth spatial moment (intensity-weighted area).</p>
- </dd>
- </dl>
- <table class="docutils footnote" frame="void" id="id1" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label">[1]</td><td><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></td></tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.regions">
- <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>
- <dd><p>regions(…) returns the Object Regions</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#module-Regions" title="Regions"><code class="xref py py-class docutils literal"><span class="pre">Regions</span></code></a></td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.set_image_intensity">
- <code class="descname">set_image_intensity</code><span class="sig-paren">(</span><em>image_intensity</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.set_image_intensity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.set_image_intensity" title="Permalink to this definition">¶</a></dt>
- <dd><p>Sets the image to measurs image’s region intensity properties (e.g, mean_intensity)</p>
- <p>: param image_intensity: Image object for intensity measurement
- : type image_intensity: Object Image
- :returns: the set Image object for intensity measurement
- :rtype: Object Image
- >>> import image_features_extraction as fe
- >>> imgs = fe.Images(folder_name)
- >>> img = imgs.item(1) # this is the binary image used for segmentation
- >>> img_intensity = imgs.item(0) # this is the original image on which to measure intensities
- >>> img.set_image_intensity(img_intensity)
- >>> features = IMG.features([‘label’, ‘area’,’perimeter’, ‘centroid’,’major_axis_length’, ‘moments’,’mean_intensity’], class_value=5)</p>
- </dd></dl>
- <dl class="method">
- <dt id="Image.Image.width">
- <code class="descname">width</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Image.html#Image.width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Image.Image.width" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="module-Regions">
- <span id="regions"></span><h2>Regions<a class="headerlink" href="#module-Regions" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="Regions.Regions">
- <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>
- <dd><p>This class represent a collection of regions: segmented image elements
- 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
- Regions(…)</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="Regions.Regions.count">
- <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>
- <dd><p>returns the number of items</p>
- </dd></dl>
- <dl class="method">
- <dt id="Regions.Regions.count_update">
- <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>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Regions.Regions.features">
- <code class="descname">features</code><span class="sig-paren">(</span><em>feature_list</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Regions.html#Regions.features"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Regions.Regions.features" title="Permalink to this definition">¶</a></dt>
- <dd><p>get_features(…) returns a table with all values for the property names given in input, and supplies an
- additional parameter for feature classification</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
- <li><strong>features</strong> (<em>List</em>) – list of property/measure names (e.g, ‘area’, ‘centroid’, etc )</li>
- <li><strong>class_value</strong> (<em>int</em><em>, </em><em>string</em><em> (</em><em>default=None</em><em>)</em>) – classification label</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <p>: param image_mask: expernal Image mask to be used for the segmentation
- :type image_mask: Image
- :returns: table cointaining all property values (columns) for all elements in the regions object (rows)
- :rtype: Pandas.DataFrame
- :example:
- >>> import image_features_extraction as fe
- >>> imgs = fe.Images(folder_name)
- >>> img = imgs.item(1)
- >>> regs = img.Regions()
- >>> feature = regs.get_features([‘label’, ‘area’,’perimeter’, ‘centroid’], class_value=1)
- >>>
- >>> # external image mask
- >>> img_masks = fe.Images(folder_name)
- >>> features = regs.get_features([‘label’, ‘area’,’perimeter’, ‘centroid’], class_value=1, image_mask=img_masks.item(1))</p>
- </dd></dl>
- <dl class="method">
- <dt id="Regions.Regions.item">
- <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>
- <dd><p>Item(..) returns the i-th image element of the regions.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Region</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Regions.Regions.prop_values">
- <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>
- <dd><p>Measure the values of the specified property/measure name (e.g., ‘area’) for all
- elements contained in the object Regions.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">property name values</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">List</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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">'area'</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>The following properties can be accessed as attributes or keys:</p>
- <dl class="docutils">
- <dt><strong>area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of region.</dd>
- <dt><strong>bbox</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Bounding box <code class="docutils literal"><span class="pre">(min_row,</span> <span class="pre">min_col,</span> <span class="pre">max_row,</span> <span class="pre">max_col)</span></code>.
- Pixels belonging to the bounding box are in the half-open interval
- <code class="docutils literal"><span class="pre">[min_row;</span> <span class="pre">max_row)</span></code> and <code class="docutils literal"><span class="pre">[min_col;</span> <span class="pre">max_col)</span></code>.</dd>
- <dt><strong>bbox_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of bounding box.</dd>
- <dt><strong>centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>.</dd>
- <dt><strong>convex_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of convex hull image.</dd>
- <dt><strong>convex_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary convex hull image which has the same size as bounding box.</dd>
- <dt><strong>coords</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(N, 2) ndarray</span></dt>
- <dd>Coordinate list <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> of the region.</dd>
- <dt><strong>eccentricity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Eccentricity of the ellipse that has the same second-moments as the
- region. The eccentricity is the ratio of the focal distance
- (distance between focal points) over the major axis length.
- The value is in the interval [0, 1).
- When it is 0, the ellipse becomes a circle.</dd>
- <dt><strong>equivalent_diameter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The diameter of a circle with the same area as the region.</dd>
- <dt><strong>euler_number</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Euler characteristic of region. Computed as number of objects (= 1)
- subtracted by number of holes (8-connectivity).</dd>
- <dt><strong>extent</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels in the total bounding box.
- Computed as <code class="docutils literal"><span class="pre">area</span> <span class="pre">/</span> <span class="pre">(rows</span> <span class="pre">*</span> <span class="pre">cols)</span></code></dd>
- <dt><strong>filled_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of filled region.</dd>
- <dt><strong>filled_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary region image with filled holes which has the same size as
- bounding box.</dd>
- <dt><strong>image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Sliced binary region image which has the same size as bounding box.</dd>
- <dt><strong>inertia_tensor</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(2, 2) ndarray</span></dt>
- <dd>Inertia tensor of the region for the rotation around its mass.</dd>
- <dt><strong>inertia_tensor_eigvals</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>The two eigen values of the inertia tensor in decreasing order.</dd>
- <dt><strong>intensity_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">ndarray</span></dt>
- <dd>Image inside region bounding box.</dd>
- <dt><strong>label</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>The label in the labeled input image.</dd>
- <dt><strong>local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box.</dd>
- <dt><strong>major_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the major axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>max_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the greatest intensity in the region.</dd>
- <dt><strong>mean_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the mean intensity in the region.</dd>
- <dt><strong>min_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the least intensity in the region.</dd>
- <dt><strong>minor_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the minor axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments up to 3rd order::</dt>
- <dd>m_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Central moments (translation invariant) up to 3rd order::</dt>
- <dd>mu_ji = sum{ array(x, y) * (x - x_c)^j * (y - y_c)^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s centroid.</p>
- </dd>
- <dt><strong>moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant).</dd>
- <dt><strong>moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Normalized moments (translation and scale invariant) up to 3rd order::</dt>
- <dd>nu_ji = mu_ji / m_00^[(i+j)/2 + 1]</dd>
- </dl>
- <p class="last">where <cite>m_00</cite> is the zeroth spatial moment.</p>
- </dd>
- <dt><strong>orientation</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Angle between the X-axis and the major axis of the ellipse that has
- the same second-moments as the region. Ranging from <cite>-pi/2</cite> to
- <cite>pi/2</cite> in counter-clockwise direction.</dd>
- <dt><strong>perimeter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Perimeter of object which approximates the contour as a line
- through the centers of border pixels using a 4-connectivity.</dd>
- <dt><strong>solidity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels of the convex hull image.</dd>
- <dt><strong>weighted_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> weighted with intensity
- image.</dd>
- <dt><strong>weighted_local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box, weighted with intensity image.</dd>
- <dt><strong>weighted_moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments of intensity image up to 3rd order::</dt>
- <dd>wm_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>weighted_moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Central moments (translation invariant) of intensity image up to
- 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wmu_ji</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">{</span> <span class="n">array</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_c</span><span class="p">)</span><span class="o">^</span><span class="n">j</span> <span class="o">*</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">y_c</span><span class="p">)</span><span class="o">^</span><span class="n">i</span> <span class="p">}</span>
- </pre></div>
- </div>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s weighted
- centroid.</p>
- </dd>
- <dt><strong>weighted_moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant) of intensity
- image.</dd>
- <dt><strong>weighted_moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Normalized moments (translation and scale invariant) of intensity
- image up to 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wnu_ji</span> <span class="o">=</span> <span class="n">wmu_ji</span> <span class="o">/</span> <span class="n">wm_00</span><span class="o">^</span><span class="p">[(</span><span class="n">i</span><span class="o">+</span><span class="n">j</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span>
- </pre></div>
- </div>
- <p class="last">where <code class="docutils literal"><span class="pre">wm_00</span></code> is the zeroth spatial moment (intensity-weighted area).</p>
- </dd>
- </dl>
- <table class="docutils footnote" frame="void" id="id2" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label">[1]</td><td><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></td></tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="module-Region">
- <span id="region"></span><h2>Region<a class="headerlink" href="#module-Region" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="Region.Region">
- <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>
- <dd><p>Object refering to a single image region</p>
- <dl class="method">
- <dt id="Region.Region.prop_value">
- <code class="descname">prop_value</code><span class="sig-paren">(</span><em>prop_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Region.html#Region.prop_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Region.Region.prop_value" title="Permalink to this definition">¶</a></dt>
- <dd><p>Measure the specified property name (e.g., ‘area’)</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">value of the property name</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int,float,list</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </span><span class="n">reg</span> <span class="o">=</span> <span class="n">regs</span><span class="o">.</span><span class="n">Region</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">area</span> <span class="o">=</span> <span class="n">reg</span><span class="o">.</span><span class="n">prop_value</span><span class="p">(</span><span class="s1">'area'</span><span class="p">)</span>
- </pre></div>
- </div>
- <p>The following properties can be accessed as attributes or keys:</p>
- <dl class="docutils">
- <dt><strong>area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of region.</dd>
- <dt><strong>bbox</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Bounding box <code class="docutils literal"><span class="pre">(min_row,</span> <span class="pre">min_col,</span> <span class="pre">max_row,</span> <span class="pre">max_col)</span></code>.
- Pixels belonging to the bounding box are in the half-open interval
- <code class="docutils literal"><span class="pre">[min_row;</span> <span class="pre">max_row)</span></code> and <code class="docutils literal"><span class="pre">[min_col;</span> <span class="pre">max_col)</span></code>.</dd>
- <dt><strong>bbox_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of bounding box.</dd>
- <dt><strong>centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>.</dd>
- <dt><strong>convex_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of convex hull image.</dd>
- <dt><strong>convex_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary convex hull image which has the same size as bounding box.</dd>
- <dt><strong>coords</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(N, 2) ndarray</span></dt>
- <dd>Coordinate list <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> of the region.</dd>
- <dt><strong>eccentricity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Eccentricity of the ellipse that has the same second-moments as the
- region. The eccentricity is the ratio of the focal distance
- (distance between focal points) over the major axis length.
- The value is in the interval [0, 1).
- When it is 0, the ellipse becomes a circle.</dd>
- <dt><strong>equivalent_diameter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The diameter of a circle with the same area as the region.</dd>
- <dt><strong>euler_number</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Euler characteristic of region. Computed as number of objects (= 1)
- subtracted by number of holes (8-connectivity).</dd>
- <dt><strong>extent</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels in the total bounding box.
- Computed as <code class="docutils literal"><span class="pre">area</span> <span class="pre">/</span> <span class="pre">(rows</span> <span class="pre">*</span> <span class="pre">cols)</span></code></dd>
- <dt><strong>filled_area</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>Number of pixels of filled region.</dd>
- <dt><strong>filled_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Binary region image with filled holes which has the same size as
- bounding box.</dd>
- <dt><strong>image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(H, J) ndarray</span></dt>
- <dd>Sliced binary region image which has the same size as bounding box.</dd>
- <dt><strong>inertia_tensor</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(2, 2) ndarray</span></dt>
- <dd>Inertia tensor of the region for the rotation around its mass.</dd>
- <dt><strong>inertia_tensor_eigvals</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>The two eigen values of the inertia tensor in decreasing order.</dd>
- <dt><strong>intensity_image</strong> <span class="classifier-delimiter">:</span> <span class="classifier">ndarray</span></dt>
- <dd>Image inside region bounding box.</dd>
- <dt><strong>label</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
- <dd>The label in the labeled input image.</dd>
- <dt><strong>local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box.</dd>
- <dt><strong>major_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the major axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>max_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the greatest intensity in the region.</dd>
- <dt><strong>mean_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the mean intensity in the region.</dd>
- <dt><strong>min_intensity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Value with the least intensity in the region.</dd>
- <dt><strong>minor_axis_length</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>The length of the minor axis of the ellipse that has the same
- normalized second central moments as the region.</dd>
- <dt><strong>moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments up to 3rd order::</dt>
- <dd>m_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Central moments (translation invariant) up to 3rd order::</dt>
- <dd>mu_ji = sum{ array(x, y) * (x - x_c)^j * (y - y_c)^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s centroid.</p>
- </dd>
- <dt><strong>moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant).</dd>
- <dt><strong>moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Normalized moments (translation and scale invariant) up to 3rd order::</dt>
- <dd>nu_ji = mu_ji / m_00^[(i+j)/2 + 1]</dd>
- </dl>
- <p class="last">where <cite>m_00</cite> is the zeroth spatial moment.</p>
- </dd>
- <dt><strong>orientation</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Angle between the X-axis and the major axis of the ellipse that has
- the same second-moments as the region. Ranging from <cite>-pi/2</cite> to
- <cite>pi/2</cite> in counter-clockwise direction.</dd>
- <dt><strong>perimeter</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Perimeter of object which approximates the contour as a line
- through the centers of border pixels using a 4-connectivity.</dd>
- <dt><strong>solidity</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
- <dd>Ratio of pixels in the region to pixels of the convex hull image.</dd>
- <dt><strong>weighted_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code> weighted with intensity
- image.</dd>
- <dt><strong>weighted_local_centroid</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
- <dd>Centroid coordinate tuple <code class="docutils literal"><span class="pre">(row,</span> <span class="pre">col)</span></code>, relative to region bounding
- box, weighted with intensity image.</dd>
- <dt><strong>weighted_moments</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><dl class="first docutils">
- <dt>Spatial moments of intensity image up to 3rd order::</dt>
- <dd>wm_ji = sum{ array(x, y) * x^j * y^i }</dd>
- </dl>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region.</p>
- </dd>
- <dt><strong>weighted_moments_central</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Central moments (translation invariant) of intensity image up to
- 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wmu_ji</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">{</span> <span class="n">array</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_c</span><span class="p">)</span><span class="o">^</span><span class="n">j</span> <span class="o">*</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">y_c</span><span class="p">)</span><span class="o">^</span><span class="n">i</span> <span class="p">}</span>
- </pre></div>
- </div>
- <p class="last">where the sum is over the <cite>x</cite>, <cite>y</cite> coordinates of the region,
- and <cite>x_c</cite> and <cite>y_c</cite> are the coordinates of the region’s weighted
- centroid.</p>
- </dd>
- <dt><strong>weighted_moments_hu</strong> <span class="classifier-delimiter">:</span> <span class="classifier">tuple</span></dt>
- <dd>Hu moments (translation, scale and rotation invariant) of intensity
- image.</dd>
- <dt><strong>weighted_moments_normalized</strong> <span class="classifier-delimiter">:</span> <span class="classifier">(3, 3) ndarray</span></dt>
- <dd><p class="first">Normalized moments (translation and scale invariant) of intensity
- image up to 3rd order:</p>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">wnu_ji</span> <span class="o">=</span> <span class="n">wmu_ji</span> <span class="o">/</span> <span class="n">wm_00</span><span class="o">^</span><span class="p">[(</span><span class="n">i</span><span class="o">+</span><span class="n">j</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span>
- </pre></div>
- </div>
- <p class="last">where <code class="docutils literal"><span class="pre">wm_00</span></code> is the zeroth spatial moment (intensity-weighted area).</p>
- </dd>
- </dl>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="module-Features">
- <span id="features"></span><h2>Features<a class="headerlink" href="#module-Features" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="Features.Features">
- <em class="property">class </em><code class="descclassname">Features.</code><code class="descname">Features</code><span class="sig-paren">(</span><em>data_frame</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features" title="Permalink to this definition">¶</a></dt>
- <dd><p>contain the dataframe</p>
- <dl class="method">
- <dt id="Features.Features.get_class_name">
- <code class="descname">get_class_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.get_class_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.get_class_name" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Features.Features.get_class_value">
- <code class="descname">get_class_value</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.get_class_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.get_class_value" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Features.Features.get_dataframe">
- <code class="descname">get_dataframe</code><span class="sig-paren">(</span><em>include_class=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.get_dataframe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.get_dataframe" title="Permalink to this definition">¶</a></dt>
- <dd><p>creates a panda data frame contining the feature values</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>include_class</strong> (<em>Boolean</em>) – if True if includes the class name and value as the last column</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="Features.Features.merge">
- <code class="descname">merge</code><span class="sig-paren">(</span><em>Features_Obj</em>, <em>how_in='inner'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.merge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.merge" title="Permalink to this definition">¶</a></dt>
- <dd><p>Merges in the current Features object a second Features object (ex. obtained from the Voronoi Object)</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
- <li><strong>Features_Obj</strong> (<a class="reference internal" href="#module-Features" title="Features"><em>Features</em></a><em> (</em><em>image_features_extraction package</em><em>)</em>) – External Features Object</li>
- <li><strong>how_in</strong> (<em>string</em>) – ‘inner’, ‘outer’</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction.Images</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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="s1">'../images/CA/1'</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">vor</span> <span class="o">=</span> <span class="n">IMG</span><span class="o">.</span><span class="n">Voronoi</span><span class="p">()</span>
- <span class="gp">>>> </span><span class="n">features1</span> <span class="o">=</span> <span class="n">IMG</span><span class="o">.</span><span class="n">features</span><span class="p">([</span><span class="s1">'area'</span><span class="p">,</span><span class="s1">'perimeter'</span><span class="p">,</span><span class="s1">'centroid'</span><span class="p">,</span><span class="s1">'bbox'</span><span class="p">,</span> <span class="s1">'eccentricity'</span><span class="p">])</span>
- <span class="gp">>>> </span><span class="n">features2</span> <span class="o">=</span> <span class="n">vor</span><span class="o">.</span><span class="n">features</span><span class="p">([</span><span class="s1">'area'</span><span class="p">,</span><span class="s1">'perimeter'</span><span class="p">,</span><span class="s1">'centroid'</span><span class="p">,</span><span class="s1">'bbox'</span><span class="p">,</span> <span class="s1">'eccentricity'</span><span class="p">])</span>
- <span class="gp">>>> </span><span class="n">features3</span> <span class="o">=</span> <span class="n">features1</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">features2</span><span class="p">,</span> <span class="n">how_in</span><span class="o">=</span><span class="s1">'inner'</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">features3</span><span class="o">.</span><span class="n">get_dataframe</span><span class="p">()</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Features.Features.save">
- <code class="descname">save</code><span class="sig-paren">(</span><em>storage_name</em>, <em>type_storage='file'</em>, <em>do_append=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.save" title="Permalink to this definition">¶</a></dt>
- <dd><p>save the current dataframe into the type of storage given in input.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
- <li><strong>storage_name</strong> (<em>string</em>) – storage name, (e.g., file name if ‘ storage type is ‘file’)</li>
- <li><strong>type_storage</strong> (<em>string</em>) – type of storage (default is ‘file’) (‘db’, ‘json’ will be future implementations)</li>
- <li><strong>do_append</strong> (<em>boolean</em>) – if True it appends to existing storage. If False it creates a new storage</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <p>if ‘do_append=True’: This version of the method does not check whether the new data are consistent with presisitng data into
- the existing storage. It just tries to append the date and might fail or not depending on the type of storage</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">1 if sucessuful otherwise 0</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">image_features_extraction</span> <span class="k">as</span> <span class="nn">fe</span>
- <span class="gp">>>> </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>
- <span class="gp">>>> </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>
- <span class="gp">>>> </span><span class="n">reg</span> <span class="o">=</span> <span class="n">img</span><span class="o">.</span><span class="n">Regions</span><span class="p">()</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">features</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">'label'</span><span class="p">,</span> <span class="s1">'area'</span><span class="p">,</span><span class="s1">'perimeter'</span><span class="p">,</span> <span class="s1">'centroid'</span><span class="p">],</span> <span class="n">class_value</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">features</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s1">'my_file_name'</span><span class="p">)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="method">
- <dt id="Features.Features.set_class_name">
- <code class="descname">set_class_name</code><span class="sig-paren">(</span><em>class_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.set_class_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.set_class_name" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="Features.Features.set_class_value">
- <code class="descname">set_class_value</code><span class="sig-paren">(</span><em>class_value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/Features.html#Features.set_class_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Features.Features.set_class_value" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
- <div class="sphinxsidebarwrapper">
- <h1 class="logo"><a href="index.html">Image Features Extraction</a></h1>
- <h3>Navigation</h3>
- <ul class="current">
- <li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
- <li class="toctree-l1 current"><a class="current reference internal" href="#">Classes/Modules</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="#module-Images">Images</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#module-Image">Image</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#module-Regions">Regions</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#module-Region">Region</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#module-Features">Features</a></li>
- </ul>
- </li>
- </ul>
- <div class="relations">
- <h3>Related Topics</h3>
- <ul>
- <li><a href="index.html">Documentation overview</a><ul>
- <li>Previous: <a href="tutorial.html" title="previous chapter">Tutorial</a></li>
- </ul></li>
- </ul>
- </div>
- <div id="searchbox" style="display: none" role="search">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <div><input type="text" name="q" /></div>
- <div><input type="submit" value="Go" /></div>
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="footer">
- ©2017, Remigio Picone.
-
- |
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.3</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
-
- |
- <a href="_sources/code.rst.txt"
- rel="nofollow">Page source</a>
- </div>
-
-
- </body>
- </html>
|