code: def process_case(self, input_data, model=None):
      # A little bit strange to access casename this way. Maybe make it an optional
      # return of the generator.
  
      # Note that input_modalities as the first input is hard-coded here. Very fragile.
  
      # If an image is being repatched, its output shape is not certain. We attempt to infer it from
      # the input data. This is wonky. Move this to PatchInference, maybe.
  
      if model is not None:
          self.model = model
  
      if self.channels_first:
          input_data = np.swapaxes(input_data, 1, -1)
  
      if self.input_channels is not None:
          input_data = np.take(
              input_data, self.input_channels, self.channels_dim
          )
  
      # Determine patch shape. Currently only extends to spatial patching.
      # This leading dims business has got to have a better solution..
      self.input_patch_shape = self.model.model_input_shape
      if self.output_patch_shape is None:
          self.output_patch_shape = self.model.model_output_shape
  
      self.input_dim = len(self.input_patch_shape) - 2
  
      if self.patch_dimensions is None:
          if self.channels_first:
              self.patch_dimensions = [
                  -1 * self.input_dim + x for x in range(self.input_dim)
              ]
          else:
              self.patch_dimensions = [
                  -1 * self.input_dim + x - 1
                  for x in range(self.input_dim)
              ]
  
          if self.output_patch_dimensions is None:
              self.output_patch_dimensions = self.patch_dimensions
  
      self.output_shape = [1] + list(self.model.model_output_shape)[
          1:
      ]  # Weird
      for i in range(len(self.patch_dimensions)):
          self.output_shape[
              self.output_patch_dimensions[i]
          ] = input_data.shape[self.patch_dimensions[i]]
  
      for layer in self.output_layers:
          self.current_layer = layer
          self.create_output_filenames()
  
          save_data(input_data[0, ..., 0], self.current_data_filename)
  
          if self.current_patch_filename is not None:
              if (
                  not os.path.exists(self.current_patch_filename)
                  or self.overwrite_patches
              ):
                  self.create_patch_hdf5_file()
                  patch_data = self.generate_patch_data(
                      input_data, model
                  )
                  print(patch_data)
  
              if self.cluster_individual_case:
                  self.cluster_patch_data(input_data)
  
          if self.open_hdf5_file is not None:
              self.open_hdf5_file.close()
  
      return None
  
imports: import numpy
  import tables
  import os
  import umap
  import matplotlib.pyplot
  import matplotlib
  import scipy.ndimage
  from sklearn.cluster import KMeans
  from deepneuro.outputs.output import Output
  from deepneuro.utilities.util import add_parameter, docker_print, replace_suffix
  from deepneuro.utilities.conversion import save_data
label_desc: Use image node_id 2 for calling the PatchInterpretability obj's underlying member method code with example usage: obj.process_case(input_data, model) and returns: None