code: def run_module(
      color_image=None,
      red_image=None,
      green_image=None,
      blue_image=None,
      fn=None,
  ):
      """Run the InvertForPrinting module
  
      Call this with Numpy arrays for the images and optionally
      specify a function (fn) whose argument is an InvertForPrinting module.
      You can specialize the module inside this function.
  
      Returns a dictionary of the pixel data of the images in the image set
      """
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
      module = (
          cellprofiler.modules.invertforprinting.InvertForPrinting()
      )
      module.set_module_num(1)
      for image, name, setting, check in (
          (color_image, I_COLOR_IN, module.color_input_image, None),
          (
              red_image,
              I_RED_IN,
              module.red_input_image,
              module.wants_red_input,
          ),
          (
              green_image,
              I_GREEN_IN,
              module.green_input_image,
              module.wants_green_input,
          ),
          (
              blue_image,
              I_BLUE_IN,
              module.blue_input_image,
              module.wants_blue_input,
          ),
      ):
          if image is not None:
              img = cellprofiler_core.image.Image(image)
              image_set.add(name, img)
              setting.value = name
              if check is not None:
                  check.value = True
          elif check is not None:
              check.value = False
      for name, setting in (
          (I_COLOR_OUT, module.color_output_image),
          (I_RED_OUT, module.red_output_image),
          (I_GREEN_OUT, module.green_output_image),
          (I_BLUE_OUT, module.blue_output_image),
      ):
          setting.value = name
      if fn is not None:
          fn(module)
      pipeline = cellprofiler_core.pipeline.Pipeline()
      pipeline.add_module(module)
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.RunException
          )
  
      pipeline.add_listener(callback)
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set,
          cellprofiler_core.object.ObjectSet(),
          cellprofiler_core.measurement.Measurements(),
          image_set_list,
      )
      module.run(workspace)
      result = {}
      for provider in image_set.providers:
          result[provider.get_name()] = provider.provide_image(
              image_set
          ).pixel_data
      return result
  
file_path: CellProfiler/tests/frontend/modules/test_invertforprinting.py
imports: import numpy
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.invertforprinting
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 1 for calling a global function with example usage: run_module(color_image, red_image, green_image, blue_image, fn) and returns: result