extract_collagen_fibers
Extract collagen fibers from a H&E image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
ndarray
|
The input image. Shape (H, W, 3). |
required |
label
|
ndarray
|
The nuclei mask. Shape (H, W). This is used to mask out the nuclei when extracting collagen fibers. If None, the entire image is used. |
None
|
sigma
|
float
|
The sigma parameter for the Canny edge detector. |
2.5
|
rm_bg
|
bool
|
Whether to remove the background component from the edges. |
False
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The collagen fibers mask. Shape (H, W). |
Examples:
>>> from histolytics.data import hgsc_stroma_he
>>> from histolytics.stroma_feats.collagen import extract_collagen_fibers
>>> from skimage.measure import label
>>> from skimage.color import label2rgb
>>> import matplotlib.pyplot as plt
>>>
>>> im = hgsc_stroma_he()
>>> collagen = extract_collagen_fibers(im, label=None)
>>>
>>> fig, ax = plt.subplots(1, 2, figsize=(8, 4))
>>> ax[0].imshow(label2rgb(label(collagen), bg_label=0))
>>> ax[0].set_axis_off()
>>> ax[1].imshow(im)
>>> ax[1].set_axis_off()
>>> fig.tight_layout()