code: def test_correct_results(
      self,
      im_type,
      degrees,
      keep_size,
      mode,
      padding_mode,
      align_corners,
  ):
      init_param = {
          "keys": "img",
          "range_x": degrees,
          "prob": 1.0,
          "keep_size": keep_size,
          "mode": mode,
          "padding_mode": padding_mode,
          "align_corners": align_corners,
          "dtype": np.float64,
      }
      rotate_fn = RandRotated(**init_param)
      im = im_type(self.imt[0])
      rotate_fn.set_random_state(243)
      call_param = {"data": {"img": im, "seg": im_type(self.segn[0])}}
      rotated = rotate_fn(**call_param)
  
      # test lazy
      test_resampler_lazy(
          rotate_fn,
          rotated,
          init_param=init_param,
          call_param=call_param,
          seed=243,
          output_key="img",
      )
  
      _order = 0 if mode == "nearest" else 1
      if padding_mode == "border":
          _mode = "nearest"
      elif padding_mode == "reflection":
          _mode = "reflect"
      else:
          _mode = "constant"
      angle = rotate_fn.rand_rotate.x
      expected = scipy.ndimage.rotate(
          self.imt[0, 0],
          -np.rad2deg(angle),
          (0, 1),
          not keep_size,
          order=_order,
          mode=_mode,
          prefilter=False,
      )
      test_local_inversion(rotate_fn, rotated, {"img": im}, "img")
      for k, v in rotated.items():
          rotated[k] = v.cpu() if isinstance(v, torch.Tensor) else v
      expected = np.stack(expected).astype(np.float32)
      good = np.sum(np.isclose(expected, rotated["img"][0], atol=1e-3))
      self.assertLessEqual(
          np.abs(good - expected.size), 40, "diff at most 40 pixels"
      )
  
file_path: MONAI/tests/test_rand_rotated.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import scipy.ndimage
  import torch
  from parameterized import parameterized
  from monai.config import USE_COMPILED
  from monai.transforms import RandRotated
  from monai.utils import GridSampleMode, GridSamplePadMode
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_NDARRAYS_ALL, NumpyImageTestCase2D, NumpyImageTestCase3D, test_local_inversion
label_desc: Use image node_id 1 for calling the TestRandRotated2D obj's underlying member method code with example usage: obj.test_correct_results(im_type, degrees, keep_size, mode, padding_mode, align_corners) without return types