scallops.segmentation.util.image2mask
- scallops.segmentation.util.image2mask(image, threshold='Li', threshold_correction_factor=1, rolling_ball=False, sigma=None, depth=30)
Convert an image to a mask.
- Parameters:
image (DataArray) – Image with the dimensions (t, c, y, x)
threshold (Literal['Li', 'Otsu', 'Local'] | float) – One of Li, Otsu, Local If Li, use Li’s iterative Minimum Cross Entropy method
threshold_li(). If Otsu, use Otsu’s methodthreshold_otsu(). If ‘Local’, compute mask using image > smoothed * threshold_correction_factorthreshold_correction_factor (float) – Factor to adjust the computed threshold by.
threshold – Threshold to apply to mask.
rolling_ball (bool) – If true, apply skimage.restoration.rolling_ball subtraction to mask prior to calculating threshold
sigma (float | None) – sigma (optional) gaussian filter sigma to smooth the image prior to computing threshold
depth (int) – The number of elements that each block should share with its neighbors when using dask
- Returns:
Image, mask, and threshold if threshold is Li or Otsu.
- Return type:
tuple[ndarray | Array, ndarray | Array, float | None]