docstr: Parameters
  ----------
  static_image_files : string
      Path of the static image file.
  
  moving_image_files : string
      Path of the moving image(s). It can be a single image or a
      folder containing multiple images.
  
  transform_map_file : string
      For the affine case, it should be a text(*.txt) file containing
      the affine matrix. For the diffeomorphic case,
      it should be a nifti file containing the mapping displacement
      field in each voxel with this shape (x, y, z, 3, 2).
  
  transform_type : string, optional
      Select the transformation type to apply between 'affine' or
      'diffeomorphic'.
  
  out_dir : string, optional
      Directory to save the transformed files (default current directory).
  
  out_file : string, optional
      Name of the transformed file.
      It is recommended to use the flag --mix-names to
      prevent the output files from being overwritten.
code: def run(
      self,
      static_image_files,
      moving_image_files,
      transform_map_file,
      transform_type="affine",
      out_dir="",
      out_file="transformed.nii.gz",
  ):
      """
      Parameters
      ----------
      static_image_files : string
          Path of the static image file.
  
      moving_image_files : string
          Path of the moving image(s). It can be a single image or a
          folder containing multiple images.
  
      transform_map_file : string
          For the affine case, it should be a text(*.txt) file containing
          the affine matrix. For the diffeomorphic case,
          it should be a nifti file containing the mapping displacement
          field in each voxel with this shape (x, y, z, 3, 2).
  
      transform_type : string, optional
          Select the transformation type to apply between 'affine' or
          'diffeomorphic'.
  
      out_dir : string, optional
          Directory to save the transformed files (default current directory).
  
      out_file : string, optional
          Name of the transformed file.
          It is recommended to use the flag --mix-names to
          prevent the output files from being overwritten.
  
      """
      if transform_type.lower() not in ["affine", "diffeomorphic"]:
          raise ValueError(
              "Invalid transformation type: Please"
              " provide a valid transform like 'affine'"
              " or 'diffeomorphic'"
          )
  
      io = self.get_io_iterator()
  
      for (
          static_image_file,
          moving_image_file,
          transform_file,
          out_file,
      ) in io:
          # Loading the image data from the input files into object.
          static_image, static_grid2world = load_nifti(
              static_image_file
          )
          moving_image, moving_grid2world = load_nifti(
              moving_image_file
          )
  
          # Doing a sanity check for validating the dimensions of the input
          # images.
          check_dimensions(static_image, moving_image)
  
          if transform_type.lower() == "affine":
              # Loading the affine matrix.
              affine_matrix = np.loadtxt(transform_file)
  
              # Setting up the affine transformation object.
              mapping = AffineMap(
                  affine=affine_matrix,
                  domain_grid_shape=static_image.shape,
                  domain_grid2world=static_grid2world,
                  codomain_grid_shape=moving_image.shape,
                  codomain_grid2world=moving_grid2world,
              )
  
          elif transform_type.lower() == "diffeomorphic":
              # Loading the diffeomorphic map.
              disp_data, disp_affine = load_nifti(transform_file)
  
              mapping = DiffeomorphicMap(
                  3,
                  disp_data.shape[:3],
                  disp_grid2world=np.linalg.inv(disp_affine),
                  domain_shape=static_image.shape,
                  domain_grid2world=static_grid2world,
                  codomain_shape=moving_image.shape,
                  codomain_grid2world=moving_grid2world,
              )
  
              mapping.forward = disp_data[..., 0]
              mapping.backward = disp_data[..., 1]
              mapping.is_inverse = True
  
          # Transforming the image/
          transformed = mapping.transform(moving_image)
  
          save_nifti(out_file, transformed, affine=static_grid2world)
  
imports: import logging
  from warnings import warn
  import numpy
  import nibabel
  from os.path import join
  from dipy.utils.optpkg import optional_package
  from dipy.align.imaffine import AffineMap
  from dipy.align.imwarp import SymmetricDiffeomorphicRegistration, DiffeomorphicMap
  from dipy.align.metrics import CCMetric, SSDMetric, EMMetric
  from dipy.align.reslice import reslice
  from dipy.align import affine_registration, motion_correction
  from dipy.align.streamlinear import slr_with_qbx
  from dipy.tracking.streamline import set_number_of_points
  from dipy.align.streamwarp import bundlewarp
  from dipy.core.gradients import mask_non_weighted_bvals, gradient_table
  from dipy.io.image import save_nifti, load_nifti, save_qa_metric
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.tracking.streamline import transform_streamlines
  from dipy.workflows.workflow import Workflow
label_desc: Use image node_id 1 for calling the ApplyTransformFlow obj's underlying member method code with example usage: obj.run(static_image_files, moving_image_files, transform_map_file, transform_type, out_dir, out_file) without return types