code: def test_shape(self, in_type, test_data, offset, expected):
      inst_bbox = get_bbox(test_data[None])
      inst_map = test_data[
          inst_bbox[0][0] : inst_bbox[0][1],
          inst_bbox[0][2] : inst_bbox[0][3],
      ]
      test_case = {"image": in_type(inst_map[None]), "offset": offset}
      result = GenerateInstanceCentroidd(
          keys="image",
          centroid_key_postfix="centroid",
          offset_key="offset",
      )(test_case)
      assert_allclose(
          result["image_centroid"], expected, type_test=False
      )
  
file_path: MONAI/tests/test_generate_instance_centroidd.py
imports: from __future__ import annotations
  import unittest
  import numpy
  from parameterized import parameterized
  from monai.apps.pathology.transforms.post.dictionary import GenerateInstanceCentroidd
  from monai.transforms import BoundingRect
  from monai.utils import min_version, optional_import
  from tests.utils import TEST_NDARRAYS, assert_allclose
label_desc: Use image node_id 1 for calling the TestGenerateInstanceCentroidd obj's underlying member method code with example usage: obj.test_shape(in_type, test_data, offset, expected) without return types