code: def test_fly():
      """Run identify on the fly image"""
      file = tests.frontend.modules.get_test_resources_directory(
          "identifyprimaryobjects/fly.pipeline"
      )
      with open(file, "r") as fd:
          data = fd.read()
  
      pipeline = cellprofiler_core.pipeline.Pipeline()
  
      def callback(pipeline, event):
          assert not isinstance(
              event,
              (
                  cellprofiler_core.pipeline.event.RunException,
                  cellprofiler_core.pipeline.event.LoadException,
              ),
          )
  
      pipeline.add_listener(callback)
      pipeline.load(io.StringIO(data))
      x = pipeline.modules()[0]
      assert isinstance(
          x,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      x.use_advanced.value = True
      img = fly_image()
      image = cellprofiler_core.image.Image(img)
      #
      # Make sure it runs both regular and with reduced image
      #
      for min_size in (9, 15):
          #
          # Exercise clumping / declumping options
          #
          x.size_range.min = min_size
          for unclump_method in (
              cellprofiler.modules.identifyprimaryobjects.UN_INTENSITY,
              cellprofiler.modules.identifyprimaryobjects.UN_SHAPE,
          ):
              x.unclump_method.value = unclump_method
              for watershed_method in (
                  cellprofiler.modules.identifyprimaryobjects.WA_INTENSITY,
                  cellprofiler.modules.identifyprimaryobjects.WA_SHAPE,
                  cellprofiler.modules.identifyprimaryobjects.WA_PROPAGATE,
              ):
                  x.watershed_method.value = watershed_method
                  image_set_list = (
                      cellprofiler_core.image.ImageSetList()
                  )
                  image_set = image_set_list.get_image_set(0)
                  image_set.add(x.x_name.value, image)
                  object_set = cellprofiler_core.object.ObjectSet()
                  measurements = (
                      cellprofiler_core.measurement.Measurements()
                  )
                  x.run(
                      cellprofiler_core.workspace.Workspace(
                          pipeline,
                          x,
                          image_set,
                          object_set,
                          measurements,
                          None,
                      )
                  )
  
imports: import io
  import os
  import centrosome.threshold
  import numpy
  import pytest
  import scipy.ndimage
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import FF_COUNT, COLTYPE_INTEGER, FF_FINAL_THRESHOLD, COLTYPE_FLOAT, FF_ORIG_THRESHOLD, M_NUMBER_OBJECT_NUMBER, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, M_LOCATION_CENTER_Z, FF_SUM_OF_ENTROPIES, FF_WEIGHTED_VARIANCE
  from cellprofiler_core.constants.module._identify import TS_GLOBAL, TS_ADAPTIVE, O_TWO_CLASS, O_FOREGROUND, O_THREE_CLASS, O_BACKGROUND, RB_MODE, RB_SD, RB_MEAN, RB_MEDIAN, RB_MAD, TS_MANUAL, TS_MEASUREMENT
  from cellprofiler_core.image import VanillaImage
  import cellprofiler.modules.identifyprimaryobjects
  import cellprofiler.modules.threshold
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend
  import tests.frontend.modules
label_desc: Use image node_id 22 for calling a global function with example usage: test_fly() without return types