code: def test_space_same_shape(self):
      affine_1 = np.array(
          [
              [1.499277e00, 2.699563e-02, 3.805804e-02, -1.948635e02],
              [-2.685805e-02, 1.499757e00, -2.635604e-12, 4.438188e01],
              [-3.805194e-02, -5.999028e-04, 1.499517e00, 4.036536e01],
              [0.000000e00, 0.000000e00, 0.000000e00, 1.000000e00],
          ]
      )
      affine_2 = np.array(
          [
              [1.499275e00, 2.692252e-02, 3.805728e-02, -1.948635e02],
              [-2.693010e-02, 1.499758e00, -4.260525e-05, 4.438188e01],
              [-3.805190e-02, -6.406730e-04, 1.499517e00, 4.036536e01],
              [0.000000e00, 0.000000e00, 0.000000e00, 1.000000e00],
          ]
      )
      img_1 = MetaTensor(np.zeros((1, 238, 145, 315)), affine=affine_1)
      img_2 = MetaTensor(np.zeros((1, 238, 145, 315)), affine=affine_2)
      out = Spacingd(("img_1", "img_2"), pixdim=1)(
          {"img_1": img_1, "img_2": img_2}
      )
      self.assertEqual(
          out["img_1"].shape, out["img_2"].shape
      )  # ensure_same_shape True
      out = Spacingd(
          ("img_1", "img_2"), pixdim=1, ensure_same_shape=False
      )({"img_1": img_1, "img_2": img_2})
      self.assertNotEqual(out["img_1"].shape, out["img_2"].shape)
  
file_path: MONAI/tests/test_spacingd.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.data.meta_obj import set_track_meta
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import affine_to_spacing
  from monai.transforms import Spacingd
  from monai.utils import ensure_tuple_rep
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_DEVICES, assert_allclose, skip_if_quick
label_desc: Use image node_id 3 for calling the TestSpacingDCase obj's underlying member method code with example usage: obj.test_space_same_shape() without return types