code: def dtype_casting(original_dtype, interp_order, as_tf=False):
      """
      Making image dtype based on user specified interp order and
      best compatibility with Tensorflow.
  
      (if interp_order > 1, all values are promoted to float32,
       this avoids errors when the input images have different dtypes)
  
       The image preprocessing steps such as normalising intensities to [-1, 1]
       will cast input into floats. We therefore cast
       almost everything to float32 in the reader. Potentially more
       complex casting rules are needed here.
  
      :param original_dtype: an input datatype
      :param interp_order: an integer of interpolation order
      :param as_tf: boolean
      :return: normalised numpy dtype if not `as_tf` else tensorflow dtypes
      """
  
      dkind = np.dtype(original_dtype).kind
      if dkind in "biu":  # handling integers
          if interp_order < 0:
              return np.int32 if not as_tf else tf.int32
          return np.float32 if not as_tf else tf.float32
      if dkind == "f":  # handling floats
          return np.float32 if not as_tf else tf.float32
  
      if as_tf:
          return tf.float32  # fallback to float32 for tensorflow
      return original_dtype
  
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 2 for calling a global function with example usage: dtype_casting(original_dtype, interp_order, as_tf) and returns: original_dtype, unknown, unknown, tf, unknown