code: def monai_affine_resample(self, metatensor, affine_matrix):
      affine = Affine(
          affine=affine_matrix,
          padding_mode="zeros",
          mode="bilinear",
          dtype=torch.float64,
          image_only=True,
      )
      output_tensor = affine(metatensor)
  
      return (
          output_tensor.squeeze()
          .permute(*torch.arange(output_tensor.ndim - 2, -1, -1))
          .array
      )
  
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 5 for calling the TestITKTorchAffineMatrixBridge obj's underlying member method code with example usage: obj.monai_affine_resample(metatensor, affine_matrix) and returns: output_tensor