Skip to content

Commit

Permalink
Fix preproc global_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Jul 25, 2024
1 parent 0f9147c commit 414b435
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/fluidimage/works/preproc/_toolbox_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def temporal_minima(img=None, weight=1.0, window_shape=None):


@iterate_multiple_imgs
def global_threshold(img=None, minima=0.0, maxima=65535.0):
def global_threshold(img=None, minima=0, maxima=None):
"""
Trims pixel intensities which are outside the interval (minima, maxima).
Expand All @@ -276,6 +276,14 @@ def global_threshold(img=None, minima=0.0, maxima=65535.0):
"""
img_out = img.copy()
if maxima is None:
dtype = img_out.dtype
try:
info = np.iinfo(dtype)
except ValueError:
maxima = 65535
else:
maxima = info.max
img_out[img_out < minima] = minima
img_out[img_out > maxima] = maxima
return img_out
Expand Down

0 comments on commit 414b435

Please sign in to comment.