class_docstr: Class that handles the logic of composing the visualizations.
  
  Args:
      mode (VisualizationMode): visualization mode, either "full" or "simple"
      task (TaskType): task type "segmentation", "detection" or "classification"
docstr: Generate the visualization for an image.
  
  Args:
      image_result (ImageResult): GT and Prediction data for a single image.
  
  Returns:
      The full or simple visualization for the image, depending on the specified mode.
docstr_tok: ["Generate","the","visualization","for","an","image",".","Args",":","image_result","(","ImageResult",")",":","GT","and","Prediction","data","for","a","single","image",".","Returns",":","The","full","or","simple","visualization","for","the","image",",","depending","on","the","specified","mode","."]
code: def visualize_image(self, image_result: ImageResult) -> np.ndarray:
      """Generate the visualization for an image.
  
      Args:
          image_result (ImageResult): GT and Prediction data for a single image.
  
      Returns:
          The full or simple visualization for the image, depending on the specified mode.
      """
      if self.mode == VisualizationMode.FULL:
          return self._visualize_full(image_result)
      if self.mode == VisualizationMode.SIMPLE:
          return self._visualize_simple(image_result)
      raise ValueError(f"Unknown visualization mode: {self.mode}")
  
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 3 for calling the Visualizer obj's underlying member method code with example usage: obj.visualize_image(image_result) and returns: self, self