class_docstr: Computes the Normalized Surface Dice (NSD) for each batch sample and class of
  predicted segmentations `y_pred` and corresponding reference segmentations `y` according to equation :eq:`nsd`.
  This implementation is based on https://arxiv.org/abs/2111.05408 and supports 2D and 3D images.
  Be aware that by default (`use_subvoxels=False`), the computation of boundaries is different from DeepMind's
  implementation https://github.com/deepmind/surface-distance.
  In this implementation, the length/area of a segmentation boundary is
  interpreted as the number of its edge pixels. In DeepMind's implementation, the length of a segmentation boundary
  depends on the local neighborhood (cf. https://arxiv.org/abs/1809.04430).
  This issue is discussed here: https://github.com/Project-MONAI/MONAI/issues/4103.
  
  The class- and batch sample-wise NSD values can be aggregated with the function `aggregate`.
  
  Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
  
  Args:
      class_thresholds: List of class-specific thresholds.
          The thresholds relate to the acceptable amount of deviation in the segmentation boundary in pixels.
          Each threshold needs to be a finite, non-negative number.
      include_background: Whether to include NSD computation on the first channel of the predicted output.
          Defaults to ``False``.
      distance_metric: The metric used to compute surface distances.
          One of [``"euclidean"``, ``"chessboard"``, ``"taxicab"``].
          Defaults to ``"euclidean"``.
      reduction: define mode of reduction to the metrics, will only apply 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.
          Defaults to ``False``.
          `not_nans` is the number of batch samples for which not all class-specific NSD values were nan values.
          If set to ``True``, the function `aggregate` will return both the aggregated NSD and the `not_nans` count.
          If set to ``False``, `aggregate` will only return the aggregated NSD.
      use_subvoxels: Whether to use subvoxel distances. Defaults to ``False``.
docstr: Aggregates the output of `_compute_tensor`.
  
  Args:
      reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
          available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
          ``"mean_channel"``, ``"sum_channel"``}, default to `self.reduction`. if "none", will not do reduction.
  
  Returns:
      If `get_not_nans` is set to ``True``, this function returns the aggregated NSD and the `not_nans` count.
      If `get_not_nans` is set to ``False``, this function returns only the aggregated NSD.
docstr_tok: ["Aggregates","the","output","of","`","_compute_tensor","`",".","Args",":","reduction",":","define","mode","of","reduction","to","the","metrics",",","will","only","apply","reduction","on","`","not-nan","`","values",",","available","reduction","modes",":","{","``","``","none","''","``",",","``","``","mean","''","``",",","``","``","sum","''","``",",","``","``","mean_batch","''","``",",","``","``","sum_batch","''","``",",","``","``","mean_channel","''","``",",","``","``","sum_channel","''","``","}",",","default","to","`","self.reduction","`",".","if","``","none","''",",","will","not","do","reduction",".","Returns",":","If","`","get_not_nans","`","is","set","to","``","True","``",",","this","function","returns","the","aggregated","NSD","and","the","`","not_nans","`","count",".","If","`","get_not_nans","`","is","set","to","``","False","``",",","this","function","returns","only","the","aggregated","NSD","."]
code: def aggregate(
      self, reduction: MetricReduction | str | None = None
  ) -> torch.Tensor | tuple[torch.Tensor, torch.Tensor]:
      r"""
      Aggregates the output of `_compute_tensor`.
  
      Args:
          reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
              available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
              ``"mean_channel"``, ``"sum_channel"``}, default to `self.reduction`. if "none", will not do reduction.
  
      Returns:
          If `get_not_nans` is set to ``True``, this function returns the aggregated NSD and the `not_nans` count.
          If `get_not_nans` is set to ``False``, this function returns only the aggregated NSD.
      """
      data = self.get_buffer()
      if not isinstance(data, torch.Tensor):
          raise ValueError(
              "the data to aggregate must be PyTorch Tensor."
          )
  
      # do metric reduction
      f, not_nans = do_metric_reduction(
          data, reduction or self.reduction
      )
      return (f, not_nans) if self.get_not_nans else f
  
file_path: MONAI/monai/metrics/surface_dice.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  from typing import Any
  import numpy
  import torch
  from monai.metrics.utils import do_metric_reduction, get_edge_surface_distance, ignore_background, prepare_spacing
  from monai.utils import MetricReduction
  from .metric import CumulativeIterationMetric
label_desc: Use image node_id 3 for calling the SurfaceDiceMetric obj's underlying member method code with example usage: obj.aggregate(reduction) and returns: unknown