overlay_probability_map¶

overlay_probability_map(img, prediction, alpha=0.35, colour_map='jet', 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. Assumed to be HW.

  • prediction (ndarray) – 2D prediction map. Values are expected to be between 0-1.

  • alpha (float) – Opacity value used for the overlay.

  • colour_map (string) – The colour map to use for the heatmap. jet is used as the default.

  • min_val (float) – Only consider pixels that are greater than or equal to min_val. Otherwise, the original WSI in those regions will be displayed.

  • alpha – Opacity value used for the overlay.

  • ax (ax) – Matplotlib axis 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