class_docstr: generate mask used in `watershed`. Only points at which mask == True will be labeled.
  
  Args:
      activation: the activation layer to be applied on the input probability map.
          It can be "softmax" or "sigmoid" string, or any callable. Defaults to "softmax".
      threshold: an optional float value to threshold to binarize probability map.
          If not provided, defaults to 0.5 when activation is not "softmax", otherwise None.
      min_object_size: objects smaller than this size (in pixel) are removed. Defaults to 10.
      dtype: target data content type to convert, default is np.uint8.
class_docstr_tok: ["generate","mask","used","in","`","watershed","`",".","Only","points","at","which","mask","==","True","will","be","labeled",".","Args",":","activation",":","the","activation","layer","to","be","applied","on","the","input","probability","map",".","It","can","be","``","softmax","''","or","``","sigmoid","''","string",",","or","any","callable",".","Defaults","to","``","softmax","''",".","threshold",":","an","optional","float","value","to","threshold","to","binarize","probability","map",".","If","not","provided",",","defaults","to","0.5","when","activation","is","not","``","softmax","''",",","otherwise","None",".","min_object_size",":","objects","smaller","than","this","size","(","in","pixel",")","are","removed",".","Defaults","to","10.","dtype",":","target","data","content","type","to","convert",",","default","is","np.uint8","."]
code: def __init__(
      self,
      activation: str | Callable = "softmax",
      threshold: float | None = None,
      min_object_size: int = 10,
      dtype: DtypeLike = np.uint8,
  ) -> None:
      self.dtype = dtype
  
      # set activation layer
      use_softmax = False
      use_sigmoid = False
      activation_fn = None
      if isinstance(activation, str):
          if activation.lower() == "softmax":
              use_softmax = True
          elif activation.lower() == "sigmoid":
              use_sigmoid = True
          else:
              raise ValueError(
                  f"The activation should be 'softmax' or 'sigmoid' string, or any callable. '{activation}' was given."
              )
      elif callable(activation):
          activation_fn = activation
      else:
          raise ValueError(
              f"The activation type should be either str or callable. '{type(activation)}' was given."
          )
      self.activation = Activations(
          softmax=use_softmax, sigmoid=use_sigmoid, other=activation_fn
      )
  
      # set discretization transform
      if not use_softmax and threshold is None:
          threshold = 0.5
      self.as_discrete = AsDiscrete(
          threshold=threshold, argmax=use_softmax
      )
  
      # set small object removal transform
      self.remove_small_objects = (
          RemoveSmallObjects(min_size=min_object_size)
          if min_object_size > 0
          else None
      )
  
imports: from __future__ import annotations
  import warnings
  from typing import Callable, Sequence
  import numpy
  import torch
  from monai.config.type_definitions import DtypeLike, NdarrayOrTensor
  from monai.transforms import Activations, AsDiscrete, BoundingRect, FillHoles, GaussianSmooth, RemoveSmallObjects, SobelGradients
  from monai.transforms.transform import Transform
  from monai.transforms.utils_pytorch_numpy_unification import max, maximum, min, sum, unique
  from monai.utils import TransformBackends, convert_to_numpy, optional_import
  from monai.utils.misc import ensure_tuple_rep
  from monai.utils.type_conversion import convert_to_dst_type, convert_to_tensor
label_desc: Use image node_id 1 to create a new GenerateWatershedMask object from inherited base classes: Transform with example: obj = GenerateWatershedMask(activation, threshold, min_object_size, dtype)