code: def get_test_generator(cf, logger):
      """
      wrapper function for creating the test batch generator pipeline.
      selects patients according to cv folds (generated by first run/fold of experiment)
      If cf.hold_out_test_set is True, gets the data from an external folder instead.
      """
      if cf.hold_out_test_set:
          cf.pp_data_path = cf.pp_test_data_path
          test_ix = None
      else:
          with open(
              os.path.join(cf.exp_dir, "fold_ids.pickle"), "rb"
          ) as handle:
              fold_list = pickle.load(handle)
          _, _, test_ix, _ = fold_list[cf.fold]
          # warnings.warn('WARNING: using validation set for testing!!!')
  
      test_paths = os.listdir(cf.pp_test_data_path)
      test_data = {"data": test_paths}
      logger.info(
          "data set loaded with: {} test patients".format(
              len(test_paths)
          )
      )
      batch_gen = {}
      batch_gen["test"] = PatientBatchIterator(test_data, cf=cf)
      batch_gen["n_test"] = len(test_paths)
      return batch_gen
  
imports: import numpy
  import os
  from collections import OrderedDict
  import pandas
  import pickle
  import time
  import subprocess
  import utils.dataloader_utils
  import preprocessing
  from batchgenerators.dataloading.data_loader import SlimDataLoaderBase
  from batchgenerators.transforms.spatial_transforms import MirrorTransform
  from batchgenerators.transforms.abstract_transforms import Compose
  from batchgenerators.dataloading.multi_threaded_augmenter import MultiThreadedAugmenter
  from batchgenerators.dataloading import SingleThreadedAugmenter
  from batchgenerators.transforms.spatial_transforms import SpatialTransform
  from batchgenerators.transforms.crop_and_pad_transforms import CenterCropTransform
  from batchgenerators.transforms.utility_transforms import ConvertSegToBoundingBoxCoordinates
  import SimpleITK
label_desc: Use image node_id 2 for calling a global function with example usage: get_test_generator(cf, logger) and returns: batch_gen