code: def results(ground_truths, est_dirs):
      """Collates the dice scores from various experiments"""
      result = {e: [] for e in est_dirs}
      result["ids"] = []
      for f in ground_truths:
          r = re.search(".*bin_seg_(.*_\d+)", f)
          if r:
              gt = imread(f)
              subj_id = r.group(1)
              result["ids"].append(subj_id)
              for exp_name in est_dirs:
                  est_path = os.path.join(
                      est_dirs[exp_name],
                      subj_id + "_niftynet_out.nii.gz",
                  )
                  est = nib.load(est_path).get_data().squeeze()
                  result[exp_name].append(dice_score(gt, est))
  
      df = pd.DataFrame(result)
      return df
  
file_path: NiftyNet/demos/unet/unet_demo_utils.py
imports: import os
  import nibabel
  import pandas
  import numpy
  import matplotlib.pyplot
  from skimage.io import imread
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: results(ground_truths, est_dirs) and returns: df