Skip to content

Commit

Permalink
more docs for hierarchical
Browse files Browse the repository at this point in the history
  • Loading branch information
aelefebv committed Oct 3, 2024
1 parent 42dc1ab commit 94cc6a5
Show file tree
Hide file tree
Showing 8 changed files with 914 additions and 9 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/nellie.feature_extraction.doctree
Binary file not shown.
510 changes: 510 additions & 0 deletions docs/_build/html/_modules/nellie/feature_extraction/hierarchical.html

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions docs/_build/html/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="main module" href="main.html" />
<link rel="prev" title="Nellie documentation" href="index.html" />

<link rel="stylesheet" href="_static/custom.css" type="text/css" />

Expand Down Expand Up @@ -249,11 +251,23 @@ <h1 class="logo"><a href="index.html">Nellie</a></h1>


<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">nellie</a><ul>
<li class="toctree-l2"><a class="reference internal" href="main.html">main module</a></li>
<li class="toctree-l2"><a class="reference internal" href="nellie.html">nellie package</a></li>
<li class="toctree-l2"><a class="reference internal" href="nellie_napari.html">nellie_napari package</a></li>
<li class="toctree-l2"><a class="reference internal" href="tests.html">tests package</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="index.html" title="previous chapter">Nellie documentation</a></li>
<li>Next: <a href="main.html" title="next chapter">main module</a></li>
</ul></li>
</ul>
</div>
Expand Down
344 changes: 336 additions & 8 deletions docs/_build/html/nellie.feature_extraction.html

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions docs/_build/html/nellie_napari.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="tests package" href="tests.html" />
<link rel="prev" title="nellie.utils package" href="nellie.utils.html" />

<link rel="stylesheet" href="_static/custom.css" type="text/css" />

Expand Down Expand Up @@ -485,11 +487,25 @@ <h1 class="logo"><a href="index.html">Nellie</a></h1>


<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">nellie</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="main.html">main module</a></li>
<li class="toctree-l2"><a class="reference internal" href="nellie.html">nellie package</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">nellie_napari package</a></li>
<li class="toctree-l2"><a class="reference internal" href="tests.html">tests package</a></li>
</ul>
</li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li><a href="modules.html">nellie</a><ul>
<li>Previous: <a href="nellie.utils.html" title="previous chapter">nellie.utils package</a></li>
<li>Next: <a href="tests.html" title="next chapter">tests package</a></li>
</ul></li>
</ul></li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/searchindex.js

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions nellie/feature_extraction/hierarchical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,26 @@ def run(self):


def aggregate_stats_for_class(child_class, t, list_of_idxs):
"""
Aggregates statistical metrics (mean, standard deviation, min, max, sum) for features of a given class at
a specific time frame.
Parameters
----------
child_class : object
The class from which the feature data is extracted. It should contain a list of statistics to aggregate
(i.e., `stats_to_aggregate`) and corresponding feature arrays.
t : int
The time frame index for which the aggregation is performed.
list_of_idxs : list of lists
A list where each sublist contains the indices of data points that should be grouped together for aggregation.
Returns
-------
dict
A dictionary where the keys are feature names and the values are dictionaries containing aggregated
statistics for each feature (mean, standard deviation, min, max, sum).
"""
# initialize a dictionary to hold lists of aggregated stats for each stat name
# aggregate_stats = {
# stat_name: {"mean": [], "std_dev": [], "25%": [], "50%": [], "75%": [], "min": [], "max": [], "range": [],
Expand Down Expand Up @@ -1330,6 +1350,23 @@ def run(self):


def distance_check(border_mask, check_coords, spacing):
"""
Calculates the minimum distance between given coordinates and a border mask using a KD-tree.
Parameters
----------
border_mask : numpy.ndarray
A binary mask where the border is marked as `True`.
check_coords : numpy.ndarray
Coordinates of the points for which distances to the border will be calculated.
spacing : tuple or list
The spacing of the image dimensions (used to scale the coordinates).
Returns
-------
numpy.ndarray
An array of distances from each point in `check_coords` to the nearest border point.
"""
border_coords = np.argwhere(border_mask) * spacing
border_tree = spatial.cKDTree(border_coords)
dist, _ = border_tree.query(check_coords * spacing, k=1)
Expand Down

0 comments on commit 94cc6a5

Please sign in to comment.