overlay_prediction_mask¶
- overlay_prediction_mask(img, prediction, alpha=0.35, label_info=None, min_val=0.0, ax=None, *, return_ax)[source]¶
Generate an overlay, given a 2D prediction map.
- Parameters:
img (ndarray) – Input image to overlay the results on top of.
prediction (ndarray) – 2D prediction map. Multi-class prediction should have values ranging from 0 to N-1, where N is the number of classes.
label_info (dict) – A dictionary containing the mapping for each integer value within prediction to its string and color. [int] : (str, (int, int, int)). By default, integer will be taken as label and color will be random.
min_val (float) – Only consider predictions greater than or equal to min_val. Otherwise, the original WSI in those regions will be displayed.
alpha (float) – Opacity value used for the overlay.
ax (ax) – Matplotlib ax object.
return_ax (bool) – Whether to return the matplotlib ax object. If not, then the overlay array will be returned.
- Returns:
If return_ax is True, return the matplotlib ax object. Else, return the overlay array.
- Return type:
np.ndarray | Axes