code: def execute(
      image,
      function,
      mask=None,
      custom_repeats=None,
      scale=None,
      module=None,
  ):
      """Run the morph module on an input and return the resulting image"""
      INPUT_IMAGE_NAME = "input"
      OUTPUT_IMAGE_NAME = "output"
      if module is None:
          module = cellprofiler.modules.morph.Morph()
      module.functions[0].function.value = function
      module.image_name.value = INPUT_IMAGE_NAME
      module.output_image_name.value = OUTPUT_IMAGE_NAME
      if custom_repeats is None:
          module.functions[
              0
          ].repeats_choice.value = cellprofiler.modules.morph.R_ONCE
      elif custom_repeats == -1:
          module.functions[
              0
          ].repeats_choice.value = cellprofiler.modules.morph.R_FOREVER
      else:
          module.functions[
              0
          ].repeats_choice.value = cellprofiler.modules.morph.R_CUSTOM
          module.functions[0].custom_repeats.value = custom_repeats
      if scale is not None:
          module.functions[0].scale.value = scale
      pipeline = cellprofiler_core.pipeline.Pipeline()
      object_set = cellprofiler_core.object.ObjectSet()
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set,
          object_set,
          cellprofiler_core.measurement.Measurements(),
          image_set_list,
      )
      image_set.add(
          INPUT_IMAGE_NAME,
          cellprofiler_core.image.Image(image, mask=mask),
      )
      module.run(workspace)
      output = image_set.get_image(OUTPUT_IMAGE_NAME)
      return output.pixel_data
  
imports: import io
  import centrosome.cpmorphology
  import centrosome.filter
  import numpy
  import pytest
  import scipy.ndimage
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.morph
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 3 for calling a global function with example usage: execute(image, function, mask, custom_repeats, scale, module) and returns: output