def get_pid_and_input_type(image_dir):
  """ Get pid and input_type from the image directory

  Args:
    image_dir: the input directory (e.g., study/pid/original/)

  Return:
    pid and input_type
  """
  dirs = image_dir.split('/')
  is_last_empty = dirs[-1] == ''
  if is_last_empty:
    pid, input_type = dirs[-2], dirs[-3]
  else:
    pid, input_type = dirs[-2], dirs[-1]

  return pid, input_type