class_docstr: Compute the loss function based on the Structural Similarity Index Measure (SSIM) Metric.
  
  For more info, visit
      https://vicuesoft.com/glossary/term/ssim-ms-ssim/
  
  SSIM reference paper:
      Wang, Zhou, et al. "Image quality assessment: from error visibility to structural
      similarity." IEEE transactions on image processing 13.4 (2004): 600-612.
docstr: Args:
      spatial_dims: number of spatial dimensions of the input images.
      data_range: value range of input images. (usually 1.0 or 255)
      kernel_type: type of kernel, can be "gaussian" or "uniform".
      win_size: window size of kernel
      kernel_sigma: standard deviation for Gaussian kernel.
      k1: stability constant used in the luminance denominator
      k2: stability constant used in the contrast denominator
      reduction: {``"none"``, ``"mean"``, ``"sum"``}
          Specifies the reduction to apply to the output. Defaults to ``"mean"``.
          - ``"none"``: no reduction will be applied.
          - ``"mean"``: the sum of the output will be divided by the number of elements in the output.
          - ``"sum"``: the output will be summed.
code: def __init__(
      self,
      spatial_dims: int,
      data_range: float = 1.0,
      kernel_type: KernelType | str = KernelType.GAUSSIAN,
      win_size: int | Sequence[int] = 11,
      kernel_sigma: float | Sequence[float] = 1.5,
      k1: float = 0.01,
      k2: float = 0.03,
      reduction: LossReduction | str = LossReduction.MEAN,
  ):
      """
      Args:
          spatial_dims: number of spatial dimensions of the input images.
          data_range: value range of input images. (usually 1.0 or 255)
          kernel_type: type of kernel, can be "gaussian" or "uniform".
          win_size: window size of kernel
          kernel_sigma: standard deviation for Gaussian kernel.
          k1: stability constant used in the luminance denominator
          k2: stability constant used in the contrast denominator
          reduction: {``"none"``, ``"mean"``, ``"sum"``}
              Specifies the reduction to apply to the output. Defaults to ``"mean"``.
              - ``"none"``: no reduction will be applied.
              - ``"mean"``: the sum of the output will be divided by the number of elements in the output.
              - ``"sum"``: the output will be summed.
  
      """
      super().__init__(reduction=LossReduction(reduction).value)
      self.spatial_dims = spatial_dims
      self._data_range = data_range
      self.kernel_type = kernel_type
  
      if not isinstance(win_size, Sequence):
          win_size = ensure_tuple_rep(win_size, spatial_dims)
      self.kernel_size = win_size
  
      if not isinstance(kernel_sigma, Sequence):
          kernel_sigma = ensure_tuple_rep(kernel_sigma, spatial_dims)
      self.kernel_sigma = kernel_sigma
  
      self.k1 = k1
      self.k2 = k2
  
      self.ssim_metric = SSIMMetric(
          spatial_dims=self.spatial_dims,
          data_range=self._data_range,
          kernel_type=self.kernel_type,
          win_size=self.kernel_size,
          kernel_sigma=self.kernel_sigma,
          k1=self.k1,
          k2=self.k2,
      )
  
file_path: MONAI/monai/losses/ssim_loss.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  import torch
  from torch.nn.modules.loss import _Loss
  from monai.metrics.regression import KernelType, SSIMMetric
  from monai.utils import LossReduction, ensure_tuple_rep
label_desc: Use image node_id 1 to create a new SSIMLoss object from inherited base classes: _Loss with example: obj = SSIMLoss(spatial_dims, data_range, kernel_type, win_size, kernel_sigma, k1, k2, reduction)