docstr: Perform illumination according to the parameters of one image setting group
  
          
docstr_tok: ["Perform","illumination","according","to","the","parameters","of","one","image","setting","group"]
code: def run_image(self, image, workspace):
      """Perform illumination according to the parameters of one image setting group"""
      #
      # Get the image names from the settings
      #
      image_name = image.image_name.value
      illum_correct_name = image.illum_correct_function_image_name.value
      corrected_image_name = image.corrected_image_name.value
      #
      # Get images from the image set
      #
      orig_image = workspace.image_set.get_image(image_name)
      illum_function = workspace.image_set.get_image(illum_correct_name)
      illum_function_pixel_data = illum_function.pixel_data
      if orig_image.pixel_data.ndim == 2:
          illum_function = workspace.image_set.get_image(
              illum_correct_name, must_be_grayscale=True
          )
      else:
          if illum_function_pixel_data.ndim == 2:
              illum_function_pixel_data = illum_function_pixel_data[
                  :, :, numpy.newaxis
              ]
      # Throw an error if image and illum data are incompatible
      if (
          orig_image.pixel_data.shape[:2]
          != illum_function_pixel_data.shape[:2]
      ):
          raise ValueError(
              "This module requires that the image and illumination function have equal dimensions.\n"
              "The %s image and %s illumination function do not (%s vs %s).\n"
              "If they are paired correctly you may want to use the Resize or Crop module to make them the same size."
              % (
                  image_name,
                  illum_correct_name,
                  orig_image.pixel_data.shape,
                  illum_function_pixel_data.shape,
              )
          )
      #
      # Either divide or subtract the illumination image from the original
      #
      if image.divide_or_subtract == DOS_DIVIDE:
          output_pixels = (
              orig_image.pixel_data / illum_function_pixel_data
          )
      elif image.divide_or_subtract == DOS_SUBTRACT:
          output_pixels = (
              orig_image.pixel_data - illum_function_pixel_data
          )
          output_pixels[output_pixels < 0] = 0
      else:
          raise ValueError(
              "Unhandled option for divide or subtract: %s"
              % image.divide_or_subtract.value
          )
  
      #
      # Optionally, clip high and low values
      #
      if self.truncate_low.value:
          output_pixels = numpy.where(
              output_pixels < 0, 0, output_pixels
          )
      if self.truncate_high.value:
          output_pixels = numpy.where(
              output_pixels > 1, 1, output_pixels
          )
  
      #
      # Save the output image in the image set and have it inherit
      # mask & cropping from the original image.
      #
      output_image = Image(output_pixels, parent_image=orig_image)
      workspace.image_set.add(corrected_image_name, output_image)
      #
      # Save images for display
      #
      if self.show_window:
          if not hasattr(workspace.display_data, "images"):
              workspace.display_data.images = {}
          workspace.display_data.images[
              image_name
          ] = orig_image.pixel_data
          workspace.display_data.images[
              corrected_image_name
          ] = output_pixels
          workspace.display_data.images[
              illum_correct_name
          ] = illum_function.pixel_data
  
imports: import numpy
  from cellprofiler_core.image import Image
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Divider, Binary
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.do_something import DoSomething
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.subscriber import ImageSubscriber
  from cellprofiler_core.setting.text import ImageName
label_desc: Use image node_id 7 for calling the CorrectIlluminationApply obj's underlying member method code with example usage: obj.run_image(image, workspace) without return types