Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Jul 12, 2023
1 parent e0a5c53 commit f39d9f9
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
Binary file modified docs/pages/doctrees/Use-cases.doctree
Binary file not shown.
Binary file modified docs/pages/doctrees/environment.pickle
Binary file not shown.
82 changes: 41 additions & 41 deletions docs/pages/html/Use-cases.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,52 +369,52 @@ <h1>SAR<a class="headerlink" href="#sar" title="Permalink to this heading"></
<p>The final results show that peak-detection for SAR images is possible using a emperical approach.</p>
<section id="denoising">
<h2>Denoising<a class="headerlink" href="#denoising" title="Permalink to this heading"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="kn">from</span> <span class="nn">findpeaks</span> <span class="kn">import</span> <span class="n">findpeaks</span>
<span class="n">fp</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="p">()</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">fp</span><span class="o">.</span><span class="n">import_example</span><span class="p">(</span><span class="s1">&#39;2dpeaks_image&#39;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">findpeaks</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">findpeaks</span> <span class="kn">import</span> <span class="n">findpeaks</span>
<span class="n">fp</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="p">()</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">fp</span><span class="o">.</span><span class="n">import_example</span><span class="p">(</span><span class="s1">&#39;2dpeaks_image&#39;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">findpeaks</span>

<span class="c1"># Some pre-processing</span>
<span class="c1"># Resize</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">resize</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span><span class="mi">300</span><span class="p">))</span>
<span class="c1"># Make grey image</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">togray</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
<span class="c1"># Scale between [0-255]</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">scale</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
<span class="c1"># Some pre-processing</span>
<span class="c1"># Resize</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">resize</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span><span class="mi">300</span><span class="p">))</span>
<span class="c1"># Make grey image</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">togray</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
<span class="c1"># Scale between [0-255]</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">scale</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>

<span class="c1"># filters parameters</span>
<span class="c1"># window size</span>
<span class="n">winsize</span> <span class="o">=</span> <span class="mi">31</span>
<span class="c1"># damping factor for frost</span>
<span class="n">k_value1</span> <span class="o">=</span> <span class="mf">2.0</span>
<span class="c1"># damping factor for lee enhanced</span>
<span class="n">k_value2</span> <span class="o">=</span> <span class="mf">1.0</span>
<span class="c1"># coefficient of variation of noise</span>
<span class="n">cu_value</span> <span class="o">=</span> <span class="mf">0.25</span>
<span class="c1"># coefficient of variation for lee enhanced of noise</span>
<span class="n">cu_lee_enhanced</span> <span class="o">=</span> <span class="mf">0.523</span>
<span class="c1"># max coefficient of variation for lee enhanced</span>
<span class="n">cmax_value</span> <span class="o">=</span> <span class="mf">1.73</span>
<span class="c1"># filters parameters</span>
<span class="c1"># window size</span>
<span class="n">winsize</span> <span class="o">=</span> <span class="mi">31</span>
<span class="c1"># damping factor for frost</span>
<span class="n">k_value1</span> <span class="o">=</span> <span class="mf">2.0</span>
<span class="c1"># damping factor for lee enhanced</span>
<span class="n">k_value2</span> <span class="o">=</span> <span class="mf">1.0</span>
<span class="c1"># coefficient of variation of noise</span>
<span class="n">cu_value</span> <span class="o">=</span> <span class="mf">0.25</span>
<span class="c1"># coefficient of variation for lee enhanced of noise</span>
<span class="n">cu_lee_enhanced</span> <span class="o">=</span> <span class="mf">0.523</span>
<span class="c1"># max coefficient of variation for lee enhanced</span>
<span class="n">cmax_value</span> <span class="o">=</span> <span class="mf">1.73</span>

<span class="c1"># Denoising</span>
<span class="c1"># fastnl</span>
<span class="n">img_fastnl</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">denoise</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;fastnl&#39;</span><span class="p">,</span> <span class="n">window</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># bilateral</span>
<span class="n">img_bilateral</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">denoise</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;bilateral&#39;</span><span class="p">,</span> <span class="n">window</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># frost filter</span>
<span class="n">image_frost</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">frost_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">damping_factor</span><span class="o">=</span><span class="n">k_value1</span><span class="p">,</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># kuan filter</span>
<span class="n">image_kuan</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">kuan_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_value</span><span class="p">)</span>
<span class="c1"># lee filter</span>
<span class="n">image_lee</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">lee_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_value</span><span class="p">)</span>
<span class="c1"># lee enhanced filter</span>
<span class="n">image_lee_enhanced</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">lee_enhanced_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="n">k_value2</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_lee_enhanced</span><span class="p">,</span> <span class="n">cmax</span><span class="o">=</span><span class="n">cmax_value</span><span class="p">)</span>
<span class="c1"># Denoising</span>
<span class="c1"># fastnl</span>
<span class="n">img_fastnl</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">denoise</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;fastnl&#39;</span><span class="p">,</span> <span class="n">window</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># bilateral</span>
<span class="n">img_bilateral</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">denoise</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;bilateral&#39;</span><span class="p">,</span> <span class="n">window</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># frost filter</span>
<span class="n">image_frost</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">frost_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">damping_factor</span><span class="o">=</span><span class="n">k_value1</span><span class="p">,</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># kuan filter</span>
<span class="n">image_kuan</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">kuan_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_value</span><span class="p">)</span>
<span class="c1"># lee filter</span>
<span class="n">image_lee</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">lee_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_value</span><span class="p">)</span>
<span class="c1"># lee enhanced filter</span>
<span class="n">image_lee_enhanced</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">lee_enhanced_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="n">k_value2</span><span class="p">,</span> <span class="n">cu</span><span class="o">=</span><span class="n">cu_lee_enhanced</span><span class="p">,</span> <span class="n">cmax</span><span class="o">=</span><span class="n">cmax_value</span><span class="p">)</span>
<span class="c1"># lee sigma filter</span>
<span class="n">image_lee_sigma</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">stats</span><span class="o">.</span><span class="n">lee_sigma_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># mean filter</span>
<span class="n">image_mean</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">mean_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># median filter</span>
<span class="n">image_median</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">median_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># mean filter</span>
<span class="n">image_mean</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">mean_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
<span class="c1"># median filter</span>
<span class="n">image_median</span> <span class="o">=</span> <span class="n">findpeaks</span><span class="o">.</span><span class="n">median_filter</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">win_size</span><span class="o">=</span><span class="n">winsize</span><span class="p">)</span>
</pre></div>
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/html/_sources/Use-cases.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ Denoising
image_lee = findpeaks.lee_filter(img.copy(), win_size=winsize, cu=cu_value)
# lee enhanced filter
image_lee_enhanced = findpeaks.lee_enhanced_filter(img.copy(), win_size=winsize, k=k_value2, cu=cu_lee_enhanced, cmax=cmax_value)
# lee sigma filter
image_lee_sigma = findpeaks.stats.lee_sigma_filter(img.copy(), win_size=winsize)
# lee sigma filter
image_lee_sigma = findpeaks.stats.lee_sigma_filter(img.copy(), win_size=winsize)
# mean filter
image_mean = findpeaks.mean_filter(img.copy(), win_size=winsize)
# median filter
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Use-cases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ Denoising
image_lee = findpeaks.lee_filter(img.copy(), win_size=winsize, cu=cu_value)
# lee enhanced filter
image_lee_enhanced = findpeaks.lee_enhanced_filter(img.copy(), win_size=winsize, k=k_value2, cu=cu_lee_enhanced, cmax=cmax_value)
# lee sigma filter
image_lee_sigma = findpeaks.stats.lee_sigma_filter(img.copy(), win_size=winsize)
# lee sigma filter
image_lee_sigma = findpeaks.stats.lee_sigma_filter(img.copy(), win_size=winsize)
# mean filter
image_mean = findpeaks.mean_filter(img.copy(), win_size=winsize)
# median filter
Expand Down
4 changes: 2 additions & 2 deletions findpeaks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

__author__ = 'Erdogan Tasksen'
__email__ = '[email protected]'
__version__ = '2.4.7'
__version__ = '2.5.0'

# module level doc-string
__doc__ = """
Expand Down Expand Up @@ -48,7 +48,7 @@
>>>
>>> # Image example
>>> from findpeaks import findpeaks
>>> fp = findpeaks(method='topology', denoise='fastnl', window=30, imsize=(300,300))
>>> fp = findpeaks(method='topology', denoise='fastnl', window=30, imsize=(300, 300))
>>> X = fp.import_example('2dpeaks_image')
>>> results = fp.fit(X)
>>> fp.plot()
Expand Down

0 comments on commit f39d9f9

Please sign in to comment.