diff --git a/slic/utils/npy.py b/slic/utils/npy.py index 73acbc03..3bf29a71 100644 --- a/slic/utils/npy.py +++ b/slic/utils/npy.py @@ -15,6 +15,9 @@ def within_fraction(data, vmin, vmax): ntotal = len(data) ngood = sum(good) + if not ntotal: + return 0 + fraction = ngood / ntotal return fraction