class_docstr: Merge and save evaluation results.
docstr: Do whatever to the results returned by unet_with_spatial_partition.
docstr_tok: ["Do","whatever","to","the","results","returned","by","unet_with_spatial_partition","."]
code: def record(self, results, pred_output_dir):
      """Do whatever to the results returned by unet_with_spatial_partition."""
      if FLAGS.output_ground_truth:
          (
              pred_liver,
              pred_lesion,
              label,
              area_int,
              area_sum,
              _,
              global_step,
          ) = results
      else:
          (
              pred_liver,
              pred_lesion,
              area_int,
              area_sum,
              _,
              global_step,
          ) = results
  
      if not tf.gfile.IsDirectory(pred_output_dir):
          tf.gfile.MakeDirs(pred_output_dir)
  
      if FLAGS.sampled_2d_slices:
          with tf.gfile.Open(
              os.path.join(
                  pred_output_dir,
                  "pred_liver_{}_{}.npy".format(
                      global_step, self._instance_i
                  ),
              ),
              "wb",
          ) as f:
              np.save(f, pred_liver)
  
          with tf.gfile.Open(
              os.path.join(
                  pred_output_dir,
                  "pred_lesion_{}_{}.npy".format(
                      global_step, self._instance_i
                  ),
              ),
              "wb",
          ) as f:
              np.save(f, pred_lesion)
  
          if FLAGS.output_ground_truth:
              with tf.gfile.Open(
                  os.path.join(
                      pred_output_dir,
                      "label_{}_{}.npy".format(
                          global_step, self._instance_i
                      ),
                  ),
                  "wb",
              ) as f:
                  np.save(f, label)
  
          self._instance_i += 1
      else:
          pred_liver = self._reshape_to_cubes(pred_liver)
          for ins_i, pred_liver_instance in enumerate(pred_liver):
              with tf.gfile.Open(
                  os.path.join(
                      pred_output_dir,
                      "pred_liver_{}_{}.npy".format(
                          global_step, self._instance_i + ins_i
                      ),
                  ),
                  "wb",
              ) as f:
                  np.save(f, pred_liver_instance)
  
          pred_lesion = self._reshape_to_cubes(pred_lesion)
          for ins_i, pred_lesion_instance in enumerate(pred_lesion):
              with tf.gfile.Open(
                  os.path.join(
                      pred_output_dir,
                      "pred_lesion_{}_{}.npy".format(
                          global_step, self._instance_i + ins_i
                      ),
                  ),
                  "wb",
              ) as f:
                  np.save(f, pred_lesion_instance)
  
          if FLAGS.output_ground_truth:
              label = self._reshape_to_cubes(label)
              for ins_i, label_instance in enumerate(label):
                  with tf.gfile.Open(
                      os.path.join(
                          pred_output_dir,
                          "label_{}_{}.npy".format(
                              global_step, self._instance_i + ins_i
                          ),
                      ),
                      "wb",
                  ) as f:
                      np.save(f, label_instance)
  
          self._instance_i += len(pred_liver)
  
      self._area_int.append(area_int)
      self._area_sum.append(area_sum)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  import mesh_tensorflow
  import numpy
  from six.moves import range
  import tensorflow.compat.v1
  from mesh_tensorflow.experimental import data_aug_lib
  from tensorflow.python.platform import flags
label_desc: Use image node_id 2 for calling the PostProcessor obj's underlying member method code with example usage: obj.record(results, pred_output_dir) without return types