code: def do_reorientation(data_array, init_axcodes, final_axcodes):
      """
      Performs the reorientation (changing order of axes)
  
      :param data_array: 5D Array to reorient
      :param init_axcodes: Initial orientation
      :param final_axcodes: Target orientation
      :return data_reoriented: New data array in its reoriented form
      """
      ornt_transf, ornt_init, ornt_fin = compute_orientation(
          init_axcodes, final_axcodes
      )
      # print(ornt_transf, init_axcodes, final_axcodes)
      if np.array_equal(ornt_init, ornt_fin):
          return data_array
      try:
          return nib.orientations.apply_orientation(
              data_array, ornt_transf
          )
      except (ValueError, IndexError):
          tf.logging.fatal(
              "reorientation undecided %s, %s", ornt_init, ornt_fin
          )
          raise ValueError
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  import errno
  import importlib
  import logging
  import os
  import re
  import sys
  import warnings
  import nibabel
  import numpy
  import pandas
  import scipy.ndimage
  import tensorflow
  from tensorflow.core.framework import summary_pb2
  from niftynet.io.image_loader import load_image_obj
  from niftynet.utilities.niftynet_global_config import NiftyNetGlobalConfig
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 9 for calling a global function with example usage: do_reorientation(data_array, init_axcodes, final_axcodes) and returns: data_array, nib