tumourkit.utils.preprocessing.apply_mask
- tumourkit.utils.preprocessing.apply_mask(img: ndarray, mask: ndarray) Tuple[ndarray, int, int]
Apply a binary mask to an RGB image.
- Parameters:
img (np.ndarray) – RGB image.
mask (np.ndarray) – Binary mask.
- Returns:
Tuple containing the masked image, the bounded box mask, the center of the mask in the masked image.
- Return type:
Tuple[np.ndarray, np.ndarray, int, int]
For efficiency only the bounded box of the mask is returned, together with the center of the box. Coordinates are indices of array.