code: def test_test_watershed_intensity_distance_double():
      """Identify by local_maxima:intensity & watershed:shape - two objects
  
      Create an object with an hourglass shape and peaks in the top and
      bottom, but with a distribution of values that's skewed so that,
      by intensity, one of the images occupies the middle. The middle
      should be shared because the watershed is done using the distance
      transform.
      """
      x = (
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects()
      )
      x.use_advanced.value = True
      x.x_name.value = "my_image"
      x.y_name.value = "my_object"
      x.exclude_size.value = False
      x.size_range.value = (2, 10)
      x.fill_holes.value = False
      x.smoothing_filter_size.value = 0
      x.automatic_smoothing.value = 0
      x.maxima_suppression_size.value = 3.6
      x.automatic_suppression.value = False
      x.unclump_method.value = (
          cellprofiler.modules.identifyprimaryobjects.UN_INTENSITY
      )
      x.watershed_method.value = (
          cellprofiler.modules.identifyprimaryobjects.WA_SHAPE
      )
      img = numpy.array(
          [
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.9,
                  0.9,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0.5,
                  0,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.5,
                  0.5,
                  0.5,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.9,
                  0.9,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
                  0,
              ],
              [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0.4,
                  0,
                  0,
                  0,
                  0,
                  0,
              ],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          ]
      )
      # We do a little blur here so that there's some monotonic decrease
      # from the central peak
      img = scipy.ndimage.gaussian_filter(img, 0.5, mode="constant")
      image = cellprofiler_core.image.Image(img)
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
      image_set.providers.append(VanillaImage("my_image", image))
      object_set = cellprofiler_core.object.ObjectSet()
      measurements = cellprofiler_core.measurement.Measurements()
      pipeline = cellprofiler_core.pipeline.Pipeline()
      x.run(
          cellprofiler_core.workspace.Workspace(
              pipeline, x, image_set, object_set, measurements, None
          )
      )
      objects = object_set.get_objects("my_object")
      assert numpy.max(objects.segmented) == 2
      assert objects.segmented[12, 7] != objects.segmented[4, 7]
  
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 20 for calling a global function with example usage: test_test_watershed_intensity_distance_double() without return types