Skip to content

Commit

Permalink
docs for boundary library
Browse files Browse the repository at this point in the history
  • Loading branch information
jcopperm committed Nov 8, 2024
1 parent e12723e commit 9178ef8
Show file tree
Hide file tree
Showing 25 changed files with 2,540 additions and 82 deletions.
4 changes: 2 additions & 2 deletions docs/_modules/celltraj/features.html
Original file line number Diff line number Diff line change
Expand Up @@ -963,13 +963,13 @@ <h1>Source code for celltraj.features</h1><div class="highlight"><pre>
<span class="n">labels_inv</span><span class="o">=-</span><span class="mi">1</span><span class="o">*</span><span class="n">labels_inv</span>
<span class="n">contact_msk</span><span class="o">=</span><span class="n">get_contact_boundaries</span><span class="p">(</span><span class="n">labels0</span><span class="p">,</span><span class="n">boundary_only</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span><span class="n">radius</span><span class="o">=</span><span class="n">radius</span><span class="p">)</span>
<span class="n">contact_labels</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">zeros_like</span><span class="p">(</span><span class="n">labels0</span><span class="p">)</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">labels0</span><span class="p">[</span><span class="n">labels0</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">]):</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">flip</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">labels0</span><span class="p">[</span><span class="n">labels0</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">])):</span>
<span class="n">indi</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">logical_and</span><span class="p">(</span><span class="n">labels0</span><span class="o">==</span><span class="n">i</span><span class="p">,</span><span class="n">contact_msk</span><span class="p">))</span>
<span class="n">jset1</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">labels</span><span class="p">[</span><span class="n">indi</span><span class="p">])</span>
<span class="n">jset2</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">labels_inv</span><span class="p">[</span><span class="n">indi</span><span class="p">])</span>
<span class="n">jset</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">concatenate</span><span class="p">((</span><span class="n">jset1</span><span class="p">,</span><span class="n">jset2</span><span class="p">)))</span>
<span class="n">jset</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">setdiff1d</span><span class="p">(</span><span class="n">jset</span><span class="p">,[</span><span class="n">i</span><span class="p">])</span>
<span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">jset</span><span class="p">:</span>
<span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">flip</span><span class="p">(</span><span class="n">jset</span><span class="p">):</span>
<span class="k">if</span> <span class="n">labels0</span><span class="o">.</span><span class="n">ndim</span><span class="o">==</span><span class="mi">2</span><span class="p">:</span>
<span class="n">contact_labels</span><span class="p">[</span><span class="n">indi</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">labels</span><span class="p">[</span><span class="n">indi</span><span class="p">]</span><span class="o">==</span><span class="n">j</span><span class="p">],</span><span class="n">indi</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="n">labels</span><span class="p">[</span><span class="n">indi</span><span class="p">]</span><span class="o">==</span><span class="n">j</span><span class="p">]]</span><span class="o">=</span><span class="n">j</span>
<span class="n">contact_labels</span><span class="p">[</span><span class="n">indi</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">labels_inv</span><span class="p">[</span><span class="n">indi</span><span class="p">]</span><span class="o">==</span><span class="n">j</span><span class="p">],</span><span class="n">indi</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="n">labels_inv</span><span class="p">[</span><span class="n">indi</span><span class="p">]</span><span class="o">==</span><span class="n">j</span><span class="p">]]</span><span class="o">=</span><span class="n">j</span>
Expand Down
7 changes: 7 additions & 0 deletions docs/_modules/celltraj/imageprep.html
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ <h1>Source code for celltraj.imageprep</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">img</span></div>


<div class="viewcode-block" id="rescale_to_int">
<a class="viewcode-back" href="../../celltraj.html#celltraj.imageprep.rescale_to_int">[docs]</a>
<span class="k">def</span> <span class="nf">rescale_to_int</span><span class="p">(</span><span class="n">img</span><span class="p">,</span><span class="n">maxint</span><span class="o">=</span><span class="mi">2</span><span class="o">**</span><span class="mi">16</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">uint16</span><span class="p">):</span>
<span class="n">img</span><span class="o">=</span><span class="n">maxint</span><span class="o">*</span><span class="p">((</span><span class="n">img</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">img</span><span class="p">))</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">img</span><span class="o">-</span><span class="n">np</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">img</span><span class="p">)))</span>
<span class="k">return</span> <span class="n">img</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span></div>


<div class="viewcode-block" id="histogram_stretch">
<a class="viewcode-back" href="../../celltraj.html#celltraj.imageprep.histogram_stretch">[docs]</a>
<span class="k">def</span> <span class="nf">histogram_stretch</span><span class="p">(</span><span class="n">img</span><span class="p">,</span><span class="n">lp</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">hp</span><span class="o">=</span><span class="mi">99</span><span class="p">):</span>
Expand Down
Loading

0 comments on commit 9178ef8

Please sign in to comment.