class_docstr: Collection of data needed to visualize the predictions for an image.
docstr: Generate heatmap overlay and segmentations, convert masks to images.
docstr_tok: ["Generate","heatmap","overlay","and","segmentations",",","convert","masks","to","images","."]
code: def __post_init__(self) -> None:
      """Generate heatmap overlay and segmentations, convert masks to images."""
      if self.anomaly_map is not None:
          self.heat_map = superimpose_anomaly_map(
              self.anomaly_map, self.image, normalize=False
          )
      if self.pred_mask is not None and self.pred_mask.max() <= 1.0:
          self.pred_mask *= 255
          self.segmentations = mark_boundaries(
              self.image, self.pred_mask, color=(1, 0, 0), mode="thick"
          )
          if self.segmentations.max() <= 1.0:
              self.segmentations = (self.segmentations * 255).astype(
                  np.uint8
              )
      if self.gt_mask is not None and self.gt_mask.max() <= 1.0:
          self.gt_mask *= 255
      if self.pred_boxes is not None:
          assert (
              self.box_labels is not None
          ), "Box labels must be provided when box locations are provided."
          self.normal_boxes = self.pred_boxes[
              ~self.box_labels.astype(bool)
          ]
          self.anomalous_boxes = self.pred_boxes[
              self.box_labels.astype(bool)
          ]
  
imports: from __future__ import annotations
  from dataclasses import dataclass, field
  from enum import Enum
  from pathlib import Path
  from typing import Iterator
  import cv2
  import matplotlib.figure
  import matplotlib.pyplot
  import numpy
  from skimage.segmentation import mark_boundaries
  from anomalib.data import TaskType
  from anomalib.data.utils import read_image
  from anomalib.post_processing.post_process import add_anomalous_label, add_normal_label, draw_boxes, superimpose_anomaly_map
label_desc: Use image node_id 1 for calling the ImageResult obj's underlying member method code with example usage: obj.__post_init__() without return types