code: def _reorient_image(img, axcodes="RAS"):
      """Reorient an image to a given orientation.
  
      Parameters
      ----------
      img : instance of SpatialImage
          The MRI image.
      axcodes : tuple | str
          The axis codes specifying the orientation, e.g. "RAS".
          See :func:`nibabel.orientations.aff2axcodes`.
  
      Returns
      -------
      img_data : ndarray
          The reoriented image data.
      vox_ras_t : ndarray
          The new transform from the new voxels to surface RAS.
  
      Notes
      -----
      .. versionadded:: 0.24
      """
      nib = _import_nibabel("reorient MRI image")
      orig_data = np.array(img.dataobj).astype(np.float32)
      # reorient data to RAS
      ornt = nib.orientations.axcodes2ornt(
          nib.orientations.aff2axcodes(img.affine)
      ).astype(int)
      ras_ornt = nib.orientations.axcodes2ornt(axcodes)
      ornt_trans = nib.orientations.ornt_transform(ornt, ras_ornt)
      img_data = nib.orientations.apply_orientation(
          orig_data, ornt_trans
      )
      orig_mgh = nib.MGHImage(orig_data, img.affine)
      aff_trans = nib.orientations.inv_ornt_aff(ornt_trans, img.shape)
      vox_ras_t = np.dot(orig_mgh.header.get_vox2ras_tkr(), aff_trans)
      return img_data, vox_ras_t
  
imports: import os.path
  from gzip import GzipFile
  from pathlib import Path
  import numpy
  from ._fiff.constants import FIFF
  from ._fiff.meas_info import read_fiducials
  from .surface import _read_mri_surface, read_surface
  from .transforms import Transform, _ensure_trans, apply_trans, combine_transforms, invert_transform, read_ras_mni_t
  from .utils import _check_fname, _check_option, _import_nibabel, _validate_type, get_subjects_dir, logger, verbose
label_desc: Use image node_id 3 for calling a global function with example usage: _reorient_image(img, axcodes) and returns: img_data,  vox_ras_t