class_docstr: Generate contour for each instance in a 2D array. Use `GenerateSuccinctContour` to only include
  the pixels to which lines need to be drawn
  
  Args:
      min_num_points: assumed that the created contour does not form a contour if it does not contain more points
          than the specified value. Defaults to 3.
      contour_level: an optional value for `skimage.measure.find_contours` to find contours in the array.
          If not provided, the level is set to `(max(image) + min(image)) / 2`.
class_docstr_tok: ["Generate","contour","for","each","instance","in","a","2D","array",".","Use","`","GenerateSuccinctContour","`","to","only","include","the","pixels","to","which","lines","need","to","be","drawn","Args",":","min_num_points",":","assumed","that","the","created","contour","does","not","form","a","contour","if","it","does","not","contain","more","points","than","the","specified","value",".","Defaults","to","3.","contour_level",":","an","optional","value","for","`","skimage.measure.find_contours","`","to","find","contours","in","the","array",".","If","not","provided",",","the","level","is","set","to","`","(","max","(","image",")","+","min","(","image",")",")","\/","2","`","."]
docstr: Args:
      inst_mask: segmentation mask for a single instance. Shape should be [1, H, W, [D]]
      offset: optional offset of starting position of the instance mask in the original array. Default to 0 for each dim.
docstr_tok: ["Args",":","inst_mask",":","segmentation","mask","for","a","single","instance",".","Shape","should","be","[","1",",","H",",","W",",","[","D","]","]","offset",":","optional","offset","of","starting","position","of","the","instance","mask","in","the","original","array",".","Default","to","0","for","each","dim","."]
code: def __call__(
      self,
      inst_mask: NdarrayOrTensor,
      offset: Sequence[int] | None = (0, 0),
  ) -> np.ndarray | None:
      """
      Args:
          inst_mask: segmentation mask for a single instance. Shape should be [1, H, W, [D]]
          offset: optional offset of starting position of the instance mask in the original array. Default to 0 for each dim.
      """
      inst_mask = inst_mask.squeeze()  # squeeze channel dim
      inst_mask = convert_to_numpy(inst_mask)
      inst_contour_cv = find_contours(
          inst_mask, level=self.contour_level
      )
      generate_contour = GenerateSuccinctContour(
          inst_mask.shape[0], inst_mask.shape[1]
      )
      inst_contour = generate_contour(inst_contour_cv)
      if inst_contour is None:
          return None
      # less than `self.min_num_points` points don't make a contour, so skip.
      # They are likely to be artifacts as the contours obtained via approximation.
      if inst_contour.shape[0] < self.min_num_points:
          print(
              f"< {self.min_num_points} points don't make a contour, so skipped!"
          )
          return None
      # check for tricky shape
      elif len(inst_contour.shape) != 2:
          print(
              f"{len(inst_contour.shape)} != 2, check for tricky shapes!"
          )
          return None
      else:
          inst_contour[:, 0] += offset[0]  # type: ignore
          inst_contour[:, 1] += offset[1]  # type: ignore
          return inst_contour
  
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 2 for calling the GenerateInstanceContour obj's underlying member method code with example usage: obj.__call__(inst_mask, offset) and returns: None, None, None, inst_contour