tissue_components
Segment background and foreground masks from H&E image. Uses k-means clustering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
ndarray
|
The input H&E image. Shape (H, W, 3). |
required |
label
|
ndarray
|
The nuclei label mask. Shape (H, W). This is used to mask out the nuclei when extracting tissue components. If None, the entire image is used. |
None
|
device
|
str
|
Device to use for computation. Options are 'cpu' or 'cuda'. If set to 'cuda', Cupy will be used for GPU acceleration. |
'cpu'
|
Returns:
Type | Description |
---|---|
Tuple[ndarray, ndarray]
|
Tuple[np.ndarray, np.ndarray]: The background and foreground masks. Shapes (H, W). |