code: def augment(self, augmentation_num=0):
      for label, data_group in list(self.data_groups.items()):
          if self.random_sample:
              axes = np.random.choice(
                  self.axes[label], self.num_downsampled, replace=False
              )
          else:
              idx = [
                  x % len(self.axes[label])
                  for x in range(
                      self.iteration,
                      self.iteration + self.num_downsampled,
                  )
              ]
              axes = np.array(self.axes[label])[idx]
  
          resampled_data = np.copy(
              data_group.augmentation_cases[augmentation_num]
          )
  
          # TODO: Put in utlitities for different amount of resampling in different dimensions
          # This is fun, but messy, rewrite
          static_slice = [slice(None)] * (
              len(resampled_data.shape) - 1
          ) + [slice(self.channel, self.channel + 1)]
          for axis in axes:
              static_slice[axis] = slice(0, None, self.factor)
  
          replaced_slices = [
              [slice(None)] * (len(resampled_data.shape) - 1)
              + [slice(self.channel, self.channel + 1)]
              for i in range(self.factor - 1)
          ]
          for axis in axes:
              for i in range(self.factor - 1):
                  replaced_slices[i][axis] = slice(
                      i + 1, None, self.factor
                  )
  
          # Gross. Would be nice to find an elegant/effecient way to do this.
          for duplicate in replaced_slices:
              replaced_data = resampled_data[duplicate]
              replacing_data = resampled_data[static_slice]
              # Need geometric axes to reference here, currently non-functional in most cases.
              for axis in [-4, -3, -2]:
                  if (
                      replaced_data.shape[axis]
                      < replacing_data.shape[axis]
                  ):
                      hedge_slice = [slice(None)] * (
                          replacing_data.ndim
                      )
                      hedge_slice[axis] = slice(
                          0, replaced_data.shape[axis]
                      )
                      replacing_data = replacing_data[hedge_slice]
  
              resampled_data[duplicate] = replacing_data
  
          data_group.augmentation_cases[
              augmentation_num + 1
          ] = resampled_data
          data_group.augmentation_strings[augmentation_num + 1] = (
              data_group.augmentation_strings[augmentation_num]
              + self.augmentation_string
              + str(self.factor)
              + "_"
              + str(axes).strip("[]").replace(" ", "")
          )
  
imports: import numpy
  from deepneuro.utilities.util import add_parameter
label_desc: Use image node_id 4 for calling the Downsample obj's underlying member method code with example usage: obj.augment(augmentation_num) without return types