Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Apr 19, 2024
0 parents commit 0594814
Show file tree
Hide file tree
Showing 54 changed files with 9,397 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e709592ec0ec557fae956cdff35c55d0
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added .nojekyll
Empty file.
191 changes: 191 additions & 0 deletions _modules/deepdespeckling/denoiser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>deepdespeckling.denoiser &mdash; deepdespeckling 0.3 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />


<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=b489f392"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="../../index.html" class="icon icon-home">
deepdespeckling
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">deepdespeckling</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">deepdespeckling</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item active">deepdespeckling.denoiser</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>Source code for deepdespeckling.denoiser</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>


<div class="viewcode-block" id="Denoiser">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser">[docs]</a>
<span class="k">class</span> <span class="nc">Denoiser</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class to share parameters beyond denoising functions</span>
<span class="sd"> &quot;&quot;&quot;</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="bp">self</span><span class="o">.</span><span class="n">device</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_device</span><span class="p">()</span>

<div class="viewcode-block" id="Denoiser.get_device">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.get_device">[docs]</a>
<span class="k">def</span> <span class="nf">get_device</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Get torch device to use depending on gpu&#39;s availability</span>

<span class="sd"> Returns:</span>
<span class="sd"> device (str): device to be used by torch</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">torch</span><span class="o">.</span><span class="n">backends</span><span class="o">.</span><span class="n">mps</span><span class="o">.</span><span class="n">is_available</span><span class="p">()</span> <span class="ow">and</span> <span class="n">torch</span><span class="o">.</span><span class="n">backends</span><span class="o">.</span><span class="n">mps</span><span class="o">.</span><span class="n">is_built</span><span class="p">():</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;mps&quot;</span>
<span class="k">elif</span> <span class="n">torch</span><span class="o">.</span><span class="n">cuda</span><span class="o">.</span><span class="n">is_available</span><span class="p">():</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;cuda:0&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;cpu&quot;</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">device</span><span class="si">}</span><span class="s2"> device is used by torch&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="n">device</span></div>


<div class="viewcode-block" id="Denoiser.initialize_axis_range">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.initialize_axis_range">[docs]</a>
<span class="k">def</span> <span class="nf">initialize_axis_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image_axis_dim</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">patch_size</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">stride_size</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Initialize the convolution range for x or y axis</span>

<span class="sd"> Args:</span>
<span class="sd"> image_axis_dim (int): axis size</span>
<span class="sd"> patch_size (int): patch size</span>
<span class="sd"> stride_size (int): stride size</span>

<span class="sd"> Returns:</span>
<span class="sd"> axis_range (list) : pixel borders of each convolution</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">image_axis_dim</span> <span class="o">==</span> <span class="n">patch_size</span><span class="p">:</span>
<span class="n">axis_range</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">axis_range</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
<span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span><span class="p">,</span> <span class="n">stride_size</span><span class="p">))</span>
<span class="k">if</span> <span class="p">(</span><span class="n">axis_range</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="n">patch_size</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">image_axis_dim</span><span class="p">:</span>
<span class="n">axis_range</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span>
<span class="nb">range</span><span class="p">(</span><span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span><span class="p">,</span> <span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>

<span class="k">return</span> <span class="n">axis_range</span></div>


<div class="viewcode-block" id="Denoiser.save_despeckled_images">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.save_despeckled_images">[docs]</a>
<span class="k">def</span> <span class="nf">save_despeckled_images</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_image_kernel">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_image_kernel">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_image_kernel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.preprocess_denoised_image">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.preprocess_denoised_image">[docs]</a>
<span class="k">def</span> <span class="nf">preprocess_denoised_image</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_image">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_image">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_image</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_images">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_images">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_images</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>
</div>

</pre></div>

</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Hadrien Mariaccia, Emanuele Delsasso.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
Loading

0 comments on commit 0594814

Please sign in to comment.