docstr: reading and convert: filepath, reader, flip
code: def test_rw_itk(self, filepath, reader, flip):
      """reading and convert: filepath, reader, flip"""
      print(filepath, reader, flip)
      fname = os.path.join(self.data_dir, filepath)
      xform = mt.LoadImageD(
          "img",
          image_only=True,
          ensure_channel_first=True,
          affine_lps_to_ras=flip,
          reader=reader,
      )
      out = xform({"img": fname})["img"]
      itk_image = metatensor_to_itk_image(
          out, channel_dim=0, dtype=float
      )
      with tempfile.TemporaryDirectory() as tempdir:
          tname = os.path.join(tempdir, filepath) + (
              ".nii.gz" if not filepath.endswith(".nii.gz") else ""
          )
          itk.imwrite(itk_image, tname, True)
          ref = mt.LoadImage(
              image_only=True,
              ensure_channel_first=True,
              reader="NibabelReader",
          )(tname)
      if out.meta["space"] != ref.meta["space"]:
          ref.affine = monai.data.utils.orientation_ras_lps(ref.affine)
      assert_allclose(
          out.affine,
          monai.data.utils.to_affine_nd(
              len(out.affine) - 1, ref.affine
          ),
          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 3 for calling the TestITKTorchRW obj's underlying member method code with example usage: obj.test_rw_itk(filepath, reader, flip) without return types