class_docstr: Generate instance centroid using `skimage.measure.centroid`.
  
  Args:
      dtype: the data type of output centroid.
class_docstr_tok: ["Generate","instance","centroid","using","`","skimage.measure.centroid","`",".","Args",":","dtype",":","the","data","type","of","output","centroid","."]
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] | int = 0
  ) -> NdarrayOrTensor:
      """
      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 = convert_to_numpy(inst_mask)
      inst_mask = inst_mask.squeeze(0)  # squeeze channel dim
      ndim = len(inst_mask.shape)
      offset = ensure_tuple_rep(offset, ndim)
  
      inst_centroid = centroid(inst_mask)
      for i in range(ndim):
          inst_centroid[i] += offset[i]
  
      return convert_to_dst_type(
          inst_centroid, inst_mask, dtype=self.dtype
      )[0]
  
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 GenerateInstanceCentroid obj's underlying member method code with example usage: obj.__call__(inst_mask, offset) and returns: convert_to_dst_type