code: def test_use_reference_space(self, ref_filepath, filepath):
      # Read the images
      image = self.reader.read(os.path.join(self.data_dir, filepath))
      image[:] = self.remove_border(image)
      ndim = image.ndim
  
      ref_image = self.reader.read(
          os.path.join(self.data_dir, ref_filepath)
      )
  
      # Set arbitary origin, spacing, direction for both of the images
      image.SetSpacing([1.2, 2.0, 1.7][:ndim])
      ref_image.SetSpacing([1.9, 1.5, 1.3][:ndim])
  
      direction = np.array(
          [
              [1.02895588, 0.22791448, 0.02429561],
              [0.21927512, 1.28632268, -0.14932226],
              [0.47455613, 0.38534345, 0.98505633],
          ],
          dtype=np.float64,
      )
      image.SetDirection(direction[:ndim, :ndim])
  
      ref_direction = np.array(
          [
              [1.26032417, -0.19243174, 0.54877414],
              [0.31958275, 0.9543068, 0.2720827],
              [-0.24106769, -0.22344502, 0.9143302],
          ],
          dtype=np.float64,
      )
      ref_image.SetDirection(ref_direction[:ndim, :ndim])
  
      image.SetOrigin([57.3, 102.0, -20.9][:ndim])
      ref_image.SetOrigin([23.3, -0.5, 23.7][:ndim])
  
      # Set affine parameters
      matrix = np.array(
          [
              [0.55915995, 0.50344867, 0.43208387],
              [0.01133669, 0.82088571, 0.86841365],
              [0.30478496, 0.94998986, 0.32742505],
          ]
      )[:ndim, :ndim]
      translation = [54.0, 2.7, -11.9][:ndim]
      center_of_rotation = [-32.3, 125.1, 0.7][:ndim]
  
      # Resample using ITK
      output_array_itk = self.itk_affine_resample(
          image, matrix, translation, center_of_rotation, ref_image
      )
  
      # MONAI
      metatensor = itk_image_to_metatensor(image)
      affine_matrix_for_monai = itk_to_monai_affine(
          image, matrix, translation, center_of_rotation, ref_image
      )
      output_array_monai = self.monai_affine_resample(
          metatensor, affine_matrix_for_monai
      )
  
      # Compare outputs
      np.testing.assert_allclose(
          output_array_monai, output_array_itk, rtol=1e-3, atol=1e-3
      )
  
imports: from __future__ import annotations
  import itertools
  import os
  import tempfile
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  import monai
  import monai.transforms
  from monai.apps import download_url
  from monai.data import ITKReader
  from monai.data.itk_torch_bridge import get_itk_image_center, itk_image_to_metatensor, itk_to_monai_affine, metatensor_to_itk_image, monai_to_itk_affine, monai_to_itk_ddf
  from monai.networks.blocks import Warp
  from monai.transforms import Affine
  from monai.utils import optional_import, set_determinism
  from tests.utils import assert_allclose, skip_if_downloading_fails, skip_if_quick, test_is_quick, testing_data_config
label_desc: Use image node_id 15 for calling the TestITKTorchAffineMatrixBridge obj's underlying member method code with example usage: obj.test_use_reference_space(ref_filepath, filepath) without return types