class_docstr: creates a test generator that iterates over entire given dataset returning 1 patient per batch.
  Can be used for monitoring if cf.val_mode = 'patient_val' for a monitoring closer to actualy evaluation (done in 3D),
  if willing to accept speed-loss during training.
  :return: out_batch: dictionary containing one patient with batch_size = n_3D_patches in 3D or
  batch_size = n_2D_patches in 2D .
class_docstr_tok: ["creates","a","test","generator","that","iterates","over","entire","given","dataset","returning","1","patient","per","batch",".","Can","be","used","for","monitoring","if","cf.val_mode","=","'patient_val","'","for","a","monitoring","closer","to","actualy","evaluation","(","done","in","3D",")",",","if","willing","to","accept","speed-loss","during","training",".",":","return",":","out_batch",":","dictionary","containing","one","patient","with","batch_size","=","n_3D_patches","in","3D","or","batch_size","=","n_2D_patches","in","2D","."]
code: def __init__(self, data, cf):  # threads in augmenter
      super(PatientBatchIterator, self).__init__(data, 0)
      self.cf = cf
      self.patient_ix = 0
      self.dataset_pids = [v["pid"] for (k, v) in data.items()]
      self.patch_size = cf.patch_size
      if len(self.patch_size) == 2:
          self.patch_size = self.patch_size + [1]
  
imports: import numpy
  import os
  from collections import OrderedDict
  import pandas
  import pickle
  import time
  import subprocess
  import utils.dataloader_utils
  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
label_desc: Use image node_id 1 to create a new PatientBatchIterator object from inherited base classes: SlimDataLoaderBase with example: obj = PatientBatchIterator(data, cf)