Skip to content

get_eosin_mask

Get the binary eosin mask from the eosin channel.

Parameters:

Name Type Description Default
img_eosin ndarray

The eosin channel. Shape (H, W, 3).

required
device str

Device to use for computation. Options are 'cpu' or 'cuda'.

'cpu'

Returns:

Type Description
ndarray

np.ndarray: The binary eosin mask. Shape (H, W).

Source code in src/histolytics/utils/im.py
def get_eosin_mask(img_eosin: np.ndarray, device: str = "cpu") -> np.ndarray:
    """Get the binary eosin mask from the eosin channel.

    Parameters:
        img_eosin (np.ndarray):
            The eosin channel. Shape (H, W, 3).
        device (str):
            Device to use for computation. Options are 'cpu' or 'cuda'.

    Returns:
        np.ndarray:
            The binary eosin mask. Shape (H, W).
    """
    if device == "cuda" and _has_cp:
        return _get_eosin_mask_cp(img_eosin)
    else:
        return _get_eosin_mask_np(img_eosin)