code: def test_load_spacingd(self, filename):
      data_dict = self.load_image(filename)
      t = time.time()
      res_dict = Spacingd(
          keys="image",
          pixdim=(1, 0.2, 1),
          diagonal=True,
          padding_mode="zeros",
      )(data_dict)
      t1 = time.time()
      print(f"time monai: {t1 - t}")
      anat = nibabel.Nifti1Image(
          np.asarray(data_dict["image"][0]),
          data_dict["image"].meta["original_affine"],
      )
      ref = resample_to_output(anat, (1, 0.2, 1), order=1)
      t2 = time.time()
      print(f"time scipy: {t2 - t1}")
      self.assertTrue(t2 >= t1)
      np.testing.assert_allclose(res_dict["image"].affine, ref.affine)
      np.testing.assert_allclose(res_dict["image"].shape[1:], ref.shape)
      np.testing.assert_allclose(
          ref.get_fdata(), res_dict["image"][0], atol=0.05
      )
  
file_path: MONAI/tests/test_load_spacing_orientation.py
imports: from __future__ import annotations
  import os
  import time
  import unittest
  import nibabel
  import numpy
  import torch
  from nibabel.processing import resample_to_output
  from parameterized import parameterized
  from monai.transforms import Compose, EnsureChannelFirstd, LoadImaged, Orientationd, Spacingd
label_desc: Use image node_id 2 for calling the TestLoadSpacingOrientation obj's underlying member method code with example usage: obj.test_load_spacingd(filename) without return types