code: def crop_test(
      self, input_param, input_shape, expected_shape, same_area=None
  ):
      base_comparison = None
      input_image = self.get_arr(input_shape)
  
      for im_type in TEST_NDARRAYS_ALL:
          with self.subTest(im_type=im_type):
              # input parameters, such as roi_start can be numpy, torch, list etc.
              for param_type in TEST_NDARRAYS_ALL + (None,):
                  with self.subTest(param_type=param_type):
                      input_param_mod = deepcopy(input_param)
                      if param_type is not None:
                          for k in (
                              "roi_start",
                              "roi_end",
                              "roi_center",
                              "roi_size",
                              "roi_scale",
                          ):
                              if k in input_param:
                                  input_param_mod[k] = param_type(
                                      input_param[k]
                                  )
                      im = im_type(input_image)
                      cropper = self.Cropper(**input_param_mod)
                      is_map = isinstance(cropper, MapTransform)
                      input_data = {"img": im} if is_map else im
                      result = cropper(input_data)
                      out_im = result["img"] if is_map else result
                      self.assertIsInstance(out_im, MetaTensor)
                      self.assertTupleEqual(
                          out_im.shape, expected_shape
                      )
                      if same_area is not None:
                          assert_allclose(
                              out_im, im[same_area], type_test=False
                          )
                      # check result is the same regardless of input type
                      if base_comparison is None:
                          base_comparison = out_im
                      else:
                          assert_allclose(out_im, base_comparison)
  
                      # test inverse
                      inv = cropper.inverse(result)
                      inv_im = inv["img"] if is_map else inv
                      self.assertIsInstance(inv_im, MetaTensor)
                      if same_area is not None:
                          assert_allclose(
                              inv_im[same_area],
                              im[same_area],
                              type_test=False,
                          )
                      self.assertEqual(inv_im.applied_operations, [])
  
file_path: MONAI/tests/croppers.py
imports: from __future__ import annotations
  import unittest
  from copy import deepcopy
  import numpy
  from monai.data.meta_tensor import MetaTensor
  from monai.transforms import Randomizable
  from monai.transforms.lazy.functional import apply_pending
  from monai.transforms.transform import MapTransform
  from tests.utils import TEST_NDARRAYS_ALL, assert_allclose
label_desc: Use image node_id 2 for calling the CropTest obj's underlying member method code with example usage: obj.crop_test(input_param, input_shape, expected_shape, same_area) without return types