class_docstr: Computes the Structural Similarity Index Measure (SSIM).
  
  .. math::
      \operatorname {SSIM}(x,y) =\frac {(2 \mu_x \mu_y + c_1)(2 \sigma_{xy} + c_2)}{((\mu_x^2 + \
              \mu_y^2 + c_1)(\sigma_x^2 + \sigma_y^2 + c_2)}
  
  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.
  
  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: define the mode to reduce metrics, will only execute reduction on `not-nan` values,
          available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
          ``"mean_channel"``, ``"sum_channel"``}, default to ``"mean"``. if "none", will not do reduction
      get_not_nans: whether to return the `not_nans` count, if True, aggregate() returns (metric, not_nans)
class_docstr_tok: ["Computes","the","Structural","Similarity","Index","Measure","(","SSIM",")",".","..","math",":",":","\\operatorname","{","SSIM","}","(","x",",","y",")","=\\frac","{","(","2","\\mu_x","\\mu_y","+","c_1",")","(","2","\\sigma_","{","xy","}","+","c_2",")","}","{","(","(","\\mu_x^2","+","\\","\\mu_y^2","+","c_1",")","(","\\sigma_x^2","+","\\sigma_y^2","+","c_2",")","}","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",".","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",":","define","the","mode","to","reduce","metrics",",","will","only","execute","reduction","on","`","not-nan","`","values",",","available","reduction","modes",":","{","``","``","none","''","``",",","``","``","mean","''","``",",","``","``","sum","''","``",",","``","``","mean_batch","''","``",",","``","``","sum_batch","''","``",",","``","``","mean_channel","''","``",",","``","``","sum_channel","''","``","}",",","default","to","``","``","mean","''","``",".","if","``","none","''",",","will","not","do","reduction","get_not_nans",":","whether","to","return","the","`","not_nans","`","count",",","if","True",",","aggregate","(",")","returns","(","metric",",","not_nans",")"]
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: MetricReduction | str = MetricReduction.MEAN,
      get_not_nans: bool = False,
  ) -> None:
      super().__init__(reduction=reduction, get_not_nans=get_not_nans)
  
      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
  
imports: from __future__ import annotations
  import math
  from abc import abstractmethod
  from collections.abc import Callable, Sequence
  from functools import partial
  from typing import Any
  import torch
  import torch.nn.functional
  from monai.metrics.utils import do_metric_reduction
  from monai.utils import MetricReduction, StrEnum, convert_data_type, ensure_tuple_rep
  from monai.utils.type_conversion import convert_to_dst_type
  from .metric import CumulativeIterationMetric
label_desc: Use image node_id 1 to create a new SSIMMetric object from inherited base classes: RegressionMetric with example: obj = SSIMMetric(spatial_dims, data_range, kernel_type, win_size, kernel_sigma, k1, k2, reduction, get_not_nans)