code: def loadImageData(filename, spacing=()):
      
      if not os.path.isfile(filename):
          colors.printc("~noentry File not found:", filename, c=1)
          return None
  
      if ".tif" in filename.lower():
          reader = vtk.vtkTIFFReader()
      elif ".slc" in filename.lower():
          reader = vtk.vtkSLCReader()
          if not reader.CanReadFile(filename):
              colors.printc("~prohibited Sorry bad slc file " + filename, c=1)
              exit(1)
      elif ".vti" in filename.lower():
          reader = vtk.vtkXMLImageDataReader()
      elif ".mhd" in filename.lower():
          reader = vtk.vtkMetaImageReader()
      reader.SetFileName(filename)
      reader.Update()
      image = reader.GetOutput()
      if len(spacing) == 3:
          image.SetSpacing(spacing[0], spacing[1], spacing[2])
      return image
docs: Read and return a ``vtkImageData`` object from file.