code: def test_setting_affine_parameters(self, filepath):
      # Read image
      image = self.reader.read(os.path.join(self.data_dir, filepath))
      image[:] = self.remove_border(image)
      ndim = image.ndim
  
      # Affine parameters
      translation = [65.2, -50.2, 33.9][:ndim]
      rotation = [0.78539816339, 1.0, -0.66][:ndim]
      scale = [2.0, 1.5, 3.2][:ndim]
      shear = [0, 1, 1.6]  # axis1, axis2, coeff
  
      # Spacing
      spacing = np.array([1.2, 1.5, 2.0])[:ndim]
      image.SetSpacing(spacing)
  
      # ITK
      matrix, translation = self.create_itk_affine_from_parameters(
          image, translation, rotation, scale, shear
      )
      output_array_itk = self.itk_affine_resample(
          image, matrix=matrix, translation=translation
      )
  
      # MONAI
      metatensor = itk_image_to_metatensor(image)
      affine_matrix_for_monai = itk_to_monai_affine(
          image, matrix, translation
      )
      output_array_monai = self.monai_affine_resample(
          metatensor, affine_matrix=affine_matrix_for_monai
      )
  
      # Make sure that the array conversion of the inputs is the same
      input_array_monai = (
          metatensor.squeeze()
          .permute(*torch.arange(metatensor.ndim - 2, -1, -1))
          .array
      )
      np.testing.assert_array_equal(
          input_array_monai, np.asarray(image)
      )
  
      # Compare outputs
      percentage = (
          100
          * np.isclose(output_array_monai, output_array_itk).sum(
              dtype=np.float64
          )
          / output_array_itk.size
      )
      self.assertGreaterEqual(percentage, 99.0)
  
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 9 for calling the TestITKTorchAffineMatrixBridge obj's underlying member method code with example usage: obj.test_setting_affine_parameters(filepath) without return types