code: def read_image_files(
      input_data, return_affine=False, channels=True, batch=True
  ):
      # Rename this function to read_data
  
      if type(input_data) is np.ndarray:
          if return_affine:
              return input_data, None
          else:
              return input_data
      elif type(input_data) is str:
          input_data = [input_data]
  
      data_list = []
      affine = None
      for data_file in input_data:
          data, _, affine, data_format = convert_input_2_numpy(
              data_file, return_all=True
          )
  
          if "image" in data_format and data.ndim == 2:
              data = data[..., np.newaxis]
  
          data_list.append(data)
  
      # This is hacked together, will need to be more flexible
      # as data types expand.
      if data_format in ["image_jpg_png", "image_other", "numpy"]:
          array = np.concatenate(
              [image for image in data_list], axis=-1
          )
      elif data_format in ["float_string"]:
          array = np.array(data_list)
      elif data_list[0].ndim == 4:
          array = np.swapaxes(
              np.stack([image for image in data_list], axis=-1), 3, 4
          )
      else:
          array = np.stack([image for image in data_list], axis=-1)
  
      # This is a little clunky.
      if return_affine:
          # This assumes all images share an affine matrix.
          # Replace with a better convert function, at some point.
          return array, affine
      else:
          return array
  
imports: import os
  import numpy
  import nibabel
  import nrrd
  import pydicom
  import subprocess
  from collections import defaultdict
  from imageio import imwrite, imread
  from deepneuro.utilities.util import grab_files_recursive, quotes
label_desc: Use image node_id 2 for calling a global function with example usage: read_image_files(input_data, return_affine, channels, batch) and returns: array,  affine, array, input_data,  None, input_data