Skip to content

Commit

Permalink
Deploying to gh-pages from main @ 568fdc3 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
benjijamorris committed Mar 6, 2024
1 parent 96f09e6 commit 28aa079
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@
<article role="main">
<h1>Source code for cyto_dl.models.im2im.utils.postprocessing.auto_thresh</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">importlib</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Union</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Union</span>


<div class="viewcode-block" id="AutoThreshold"><a class="viewcode-back" href="../../../../../../cyto_dl.models.im2im.utils.postprocessing.auto_thresh.html#cyto_dl.models.im2im.utils.postprocessing.auto_thresh.AutoThreshold">[docs]</a><span class="k">class</span> <span class="nc">AutoThreshold</span><span class="p">:</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">]):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">method</span><span class="p">,</span> <span class="nb">float</span><span class="p">):</span>

<span class="k">def</span> <span class="nf">thresh_func</span><span class="p">(</span><span class="n">image</span><span class="p">):</span>
Expand All @@ -420,11 +420,15 @@ <h1>Source code for cyto_dl.models.im2im.utils.postprocessing.auto_thresh</h1><d
<span class="n">thresh_func</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">importlib</span><span class="o">.</span><span class="n">import_module</span><span class="p">(</span><span class="s2">&quot;skimage.filters&quot;</span><span class="p">),</span> <span class="n">method</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">AttributeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;method </span><span class="si">{</span><span class="n">method</span><span class="si">}</span><span class="s2"> not found in skimage.filters&quot;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">method</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">thresh_func</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s2">&quot;method must be a float or a string&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">thresh_func</span> <span class="o">=</span> <span class="n">thresh_func</span>

<span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="p">):</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">thresh_func</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="n">image</span>
<span class="k">return</span> <span class="n">image</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">thresh_func</span><span class="p">(</span><span class="n">image</span><span class="p">)</span></div>
</pre></div>
</article>
Expand Down
2 changes: 1 addition & 1 deletion cyto_dl.models.im2im.utils.postprocessing.auto_thresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
<span id="cyto-dl-models-im2im-utils-postprocessing-auto-thresh-module"></span><h1>cyto_dl.models.im2im.utils.postprocessing.auto_thresh module<a class="headerlink" href="#module-cyto_dl.models.im2im.utils.postprocessing.auto_thresh" title="Permalink to this heading">#</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="cyto_dl.models.im2im.utils.postprocessing.auto_thresh.AutoThreshold">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cyto_dl.models.im2im.utils.postprocessing.auto_thresh.</span></span><span class="sig-name descname"><span class="pre">AutoThreshold</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cyto_dl/models/im2im/utils/postprocessing/auto_thresh.html#AutoThreshold"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cyto_dl.models.im2im.utils.postprocessing.auto_thresh.AutoThreshold" title="Permalink to this definition">#</a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cyto_dl.models.im2im.utils.postprocessing.auto_thresh.</span></span><span class="sig-name descname"><span class="pre">AutoThreshold</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cyto_dl/models/im2im/utils/postprocessing/auto_thresh.html#AutoThreshold"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cyto_dl.models.im2im.utils.postprocessing.auto_thresh.AutoThreshold" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
</dd></dl>

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 28aa079

Please sign in to comment.