code: def read_image(img_spec, bkground_thresh, ensure_num_dim=3):
      
  
      img = load_image_from_disk(img_spec)
  
      if not np.issubdtype(img.dtype, np.floating):
          img = img.astype('float32')
  
      if ensure_num_dim == 3:
          img = check_image_is_3d(img)
      elif ensure_num_dim == 4:
          img = check_image_is_4d(img)
  
      return threshold_image(img, bkground_thresh)
docs: Image reader, with additional checks on size.
  
      Can optionally remove stray values close to zero (smaller than 5 %ile).