code: def read_mapping(disp, domain_img, codomain_img, prealign=None):
      """Read a syn registration mapping from a nifti file.
  
      Parameters
      ----------
      disp : str or Nifti1Image
          A file of image containing the mapping displacement field in each voxel
          Shape (x, y, z, 3, 2)
  
      domain_img : str or Nifti1Image
  
      codomain_img : str or Nifti1Image
  
      Returns
      -------
      A :class:`DiffeomorphicMap` object.
  
      Notes
      -----
      See :func:`write_mapping` for the data format expected.
  
      """
      if isinstance(disp, str):
          disp_data, disp_affine = load_nifti(disp)
  
      if isinstance(domain_img, str):
          domain_img = nib.load(domain_img)
  
      if isinstance(codomain_img, str):
          codomain_img = nib.load(codomain_img)
  
      mapping = DiffeomorphicMap(
          3,
          disp_data.shape[:3],
          disp_grid2world=np.linalg.inv(disp_affine),
          domain_shape=domain_img.shape[:3],
          domain_grid2world=domain_img.affine,
          codomain_shape=codomain_img.shape,
          codomain_grid2world=codomain_img.affine,
          prealign=prealign,
      )
  
      mapping.forward = disp_data[..., 0]
      mapping.backward = disp_data[..., 1]
      mapping.is_inverse = True
  
      return mapping
  
imports: from warnings import warn
  import re
  import collections.abc
  from functools import partial
  import numbers
  import numpy
  import nibabel
  from dipy.align.metrics import CCMetric, EMMetric, SSDMetric
  from dipy.align.imwarp import SymmetricDiffeomorphicRegistration, DiffeomorphicMap
  from dipy.align.imaffine import transform_centers_of_mass, AffineMap, MutualInformationMetric, AffineRegistration
  from dipy.align.transforms import TranslationTransform3D, RigidTransform3D, RigidScalingTransform3D, RigidIsoScalingTransform3D, AffineTransform3D
  import dipy.core.gradients
  import dipy.data
  from dipy.align.streamlinear import StreamlineLinearRegistration
  from dipy.tracking.streamline import set_number_of_points
  from dipy.tracking.utils import transform_tracking_output
  from dipy.io.streamline import load_trk
  from dipy.io.utils import read_img_arr_or_path
  from dipy.io.image import load_nifti, save_nifti
label_desc: Use image node_id 5 for calling a global function with example usage: read_mapping(disp, domain_img, codomain_img, prealign) and returns: mapping