threshold_mask#

anri.index.threshold_mask(image, threshold=None)[source]#

Mask of the sample: the convex hull of the largest connected region above a threshold (default Otsu’s).

As ImageD11’s threshold_mask, but only the largest region (8-connected) goes into the hull: a few noisy pixels above the threshold away from the sample would otherwise stretch the hull over them.

Parameters:
Returns:

np.ndarray – [ny, nx] bool