Skip to content

Commit

Permalink
Merge pull request #89 from zoccoler/fix_ellipsoid_axis_length_error
Browse files Browse the repository at this point in the history
Clip min eigenvalues to 0 to block negative values in sqrt
  • Loading branch information
haesleinhuepf authored Oct 5, 2024
2 parents e38cc72 + 862d4af commit 2863eb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion napari_skimage_regionprops/_regionprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def ellipsoid_axis_lengths(table):
S = np.asarray([[sxx, sxy, sxz], [sxy, syy, syz], [sxz, syz, szz]])
# determine eigenvalues in descending order
eigvals = np.sort(np.linalg.eigvalsh(S))[::-1]
return tuple([math.sqrt(20.0 * e) for e in eigvals])
return tuple([math.sqrt(20.0 * np.clip(e, a_min=0, a_max=None)) for e in eigvals])

regionprops_table_all_frames = analyze_all_frames(regionprops_table)
register_function(regionprops_table_all_frames, menu="Measurement tables > Regionprops of all frames (nsr)")
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ deps =
pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
pytest-xvfb ; sys_platform == 'linux'
# you can remove these if you don't use them
napari
napari<0.5.0
magicgui
pytest-qt
qtpy
Expand Down

0 comments on commit 2863eb0

Please sign in to comment.