campa.pl.annotate_img

annotate_img(img, annotation=None, from_col='clustering', to_col=None, color=False)[source]

Annotate cluster image.

Parameters
  • img (ndarray) – Image to annotate.

  • annotation (Optional[DataFrame]) – Cluster.cluster_annotation containing mapping of classes to cluster names and colours.

  • from_col (str) – Annotation column containing current values in image.

  • to_col (Optional[str]) – Annotation column containing desired mapping. If None, use from_col.

  • color (bool) – If True, use annotation column to_col+"_colors" to get colormap and colour image.

Return type

Annotated image.