residual_artifacts_and_coverage
Creates a binary mask of residual artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img
|
RGBImage
|
Image of a tissue. |
required |
conversion
|
ColorConversion
|
Conversion that describes the used staining protocol. |
required |
nucleus_area
|
int
|
Approximate area of a single cell nucleus in pixels. |
required |
res_index
|
int
|
Index of the residual channel in the used staining conversion. |
required |
threshold
|
float
|
Threshold that determines if a given pixel is an artifact.
Currently recommended threshold value for H&E stained slides is |
required |
Returns:
| Type | Description |
|---|---|
ResidualArtifacts
|
Dictionary with a binary coverage mask and a coverage number. |
Note
The returned dictionary contains the following values:
| Key | Description |
|---|---|
coverage_mask |
Binary mask of the detected residual artifacts. |
coverage |
A number that states what portion of the image's foreground area is covered by the artifacts. |
Examples:
from skimage.data import immunohistochemistry
from rationai.qc import residual_artifacts_and_coverage
from rationai.staining import ColorConversion
img = immunohistochemistry()
result = residual_artifacts_and_coverage(
img, ColorConversion.RGB2HDR, nucleus_area=150, res_index=2, threshold=0.013
)
mask = result["coverage_mask"] # Contains values 0 and 1
print(result["coverage"])
Source code in rationai/qc/residual_artifacts/residual_artifacts_and_coverage.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |