class_docstr: Callback that visualizes the results of a model.
  
  To save the images to the filesystem, add the 'local' keyword to the `project.log_images_to` parameter in the
  config.yaml file.
class_docstr_tok: ["Callback","that","visualizes","the","results","of","a","model",".","To","save","the","images","to","the","filesystem",",","add","the","'local","'","keyword","to","the","`","project.log_images_to","`","parameter","in","the","config.yaml","file","."]
docstr: Log image from a visualizer to each of the available loggers in the project.
  
  Args:
      image (np.ndarray): Image that should be added to the loggers.
      module (AnomalyModule): Anomaly module.
      trainer (Trainer): Pytorch Lightning trainer which holds reference to `logger`
      filename (Path): Path of the input image. This name is used as name for the generated image.
docstr_tok: ["Log","image","from","a","visualizer","to","each","of","the","available","loggers","in","the","project",".","Args",":","image","(","np.ndarray",")",":","Image","that","should","be","added","to","the","loggers",".","module","(","AnomalyModule",")",":","Anomaly","module",".","trainer","(","Trainer",")",":","Pytorch","Lightning","trainer","which","holds","reference","to","`","logger","`","filename","(","Path",")",":","Path","of","the","input","image",".","This","name","is","used","as","name","for","the","generated","image","."]
code: def _add_to_logger(
      self,
      image: np.ndarray,
      module: AnomalyModule,
      trainer: pl.Trainer,
      filename: str | Path,
  ) -> None:
      """Log image from a visualizer to each of the available loggers in the project.
  
      Args:
          image (np.ndarray): Image that should be added to the loggers.
          module (AnomalyModule): Anomaly module.
          trainer (Trainer): Pytorch Lightning trainer which holds reference to `logger`
          filename (Path): Path of the input image. This name is used as name for the generated image.
      """
      # Store names of logger and the logger in a dict
      available_loggers = {
          type(logger)
          .__name__.lower()
          .rstrip("logger")
          .lstrip("anomalib"): logger
          for logger in trainer.loggers
      }
      # save image to respective logger
      if self.log_images:
          for log_to in available_loggers:
              # check if logger object is same as the requested object
              if isinstance(available_loggers[log_to], ImageLoggerBase):
                  logger: ImageLoggerBase = cast(
                      ImageLoggerBase, available_loggers[log_to]
                  )  # placate mypy
                  if isinstance(filename, Path):
                      _name = filename.parent.name + "_" + filename.name
                  elif isinstance(filename, str):
                      _name = filename
                  logger.add_image(
                      image=image,
                      name=_name,
                      global_step=module.global_step,
                  )
  
file_path: anomalib/src/anomalib/utils/callbacks/visualizer/visualizer_base.py
imports: from __future__ import annotations
  from pathlib import Path
  from typing import cast
  import numpy
  import pytorch_lightning
  from pytorch_lightning import Callback
  from anomalib.data import TaskType
  from anomalib.models.components import AnomalyModule
  from anomalib.post_processing import VisualizationMode, Visualizer
  from anomalib.utils.loggers import AnomalibWandbLogger
  from anomalib.utils.loggers.base import ImageLoggerBase
label_desc: Use image node_id 2 for calling the BaseVisualizerCallback obj's underlying member method code with example usage: obj._add_to_logger(image, module, trainer, filename) without return types