docstr: There are some batch dimension problems with output_shape here. Hacky fixes for now, but revisit. TODO
          
docstr_tok: ["There","are","some","batch","dimension","problems","with","output_shape","here",".","Hacky","fixes","for","now",",","but","revisit",".","TODO"]
code: def initialize_augmentation(self):
      """There are some batch dimension problems with output_shape here. Hacky fixes for now, but revisit. TODO"""
  
      if not self.initialization:
          # A weird way to proportionally divvy up patch conditions.
          # TODO: Rewrite
          self.condition_list = [None] * (self.multiplier)
          self.region_list = [None] * (self.multiplier)
  
          if self.patch_extraction_conditions is not None:
              start_idx = 0
              for (
                  condition_idx,
                  patch_extraction_condition,
              ) in enumerate(self.patch_extraction_conditions):
                  end_idx = start_idx + int(
                      np.ceil(
                          patch_extraction_condition[1]
                          * self.multiplier
                      )
                  )
                  self.condition_list[start_idx:end_idx] = [
                      condition_idx
                  ] * (end_idx - start_idx)
                  start_idx = end_idx
  
          if self.patch_region_conditions is not None:
              start_idx = 0
              for condition_idx, patch_region_condition in enumerate(
                  self.patch_region_conditions
              ):
                  end_idx = start_idx + int(
                      np.ceil(
                          patch_region_condition[1] * self.multiplier
                      )
                  )
                  self.region_list[start_idx:end_idx] = [
                      condition_idx
                  ] * (end_idx - start_idx)
                  start_idx = end_idx
              shuffle(self.region_list)
  
          for label, data_group in list(self.data_groups.items()):
              self.input_shape[label] = data_group.get_shape()
              if label not in list(self.patch_dimensions.keys()):
                  # If no provided patch dimensions, just presume the format is [batch, patch_dimensions, channel]
                  # self.patch_dimensions[label] = [-4 + x for x in xrange(len(self.input_shape[label]) - 1)]
                  self.patch_dimensions[label] = [
                      x + 1
                      for x in range(len(self.input_shape[label]) - 1)
                  ]
  
              # This is a little goofy.
              self.output_shape[label] = np.array(
                  self.input_shape[label]
              )
              # self.output_shape[label][self.patch_dimensions[label]] = list(self.patch_shape)
              self.output_shape[label][
                  [x - 1 for x in self.patch_dimensions[label]]
              ] = list(self.patch_shape)
              self.output_shape[label] = tuple(self.output_shape[label])
  
              # Batch dimension correction, revisit
              # self.patch_dimensions[label] = [x + 1 for x in self.patch_dimensions[label]]
  
          self.initialization = True
  
imports: import numpy
  from random import shuffle
  from scipy.sparse import csr_matrix
  from deepneuro.utilities.util import add_parameter
  from deepneuro.augmentation.augment import Augmentation
label_desc: Use image node_id 2 for calling the ExtractPatches obj's underlying member method code with example usage: obj.initialize_augmentation() without return types