code: def test_run_markers_declump_intensity(
      image, module, image_set, workspace, downsample, gaussian_sigma
  ):
      module.use_advanced.value = True
  
      module.watershed_method.value = "Markers"
  
      module.declump_method.value = "Intensity"
  
      module.x_name.value = "input_image"
  
      module.y_name.value = "watershed"
  
      module.markers_name.value = "markers"
  
      module.intensity_name.value = "intensity"
  
      module.downsample.value = downsample
  
      module.gaussian_sigma.value = gaussian_sigma
  
      if image.multichannel:
          image.pixel_data = skimage.color.rgb2gray(image.pixel_data)
  
      seed_coords = skimage.feature.peak_local_max(
          image.pixel_data,
          min_distance=1,
          threshold_rel=0,
          num_peaks=numpy.inf,
          exclude_border=False,
      )
      markers_image = numpy.zeros(image.pixel_data.shape, dtype=bool)
      markers_image[tuple(seed_coords.T)] = True
      markers_image = scipy.ndimage.label(markers_image)[0]
  
      if image.dimensions == 3:
          module.structuring_element.value = "Ball,1"
          structuring_element = "Ball"
          structuring_element_size = 1
      else:
          module.structuring_element.value = "Disk,1"
          structuring_element = "Disk"
          structuring_element_size = 1
  
      image_set.add(
          "markers",
          cellprofiler_core.image.Image(
              image=markers_image,
              convert=False,
              dimensions=image.dimensions,
          ),
      )
  
      # Create an intensity image that is similar to the input
      intensity_image = skimage.filters.rank.median(image.pixel_data)
  
      image_set.add(
          "intensity",
          cellprofiler_core.image.Image(
              image=intensity_image,
              convert=False,
              dimensions=image.dimensions,
          ),
      )
  
      # Watershed requires a thresholded input
      input_image = image.pixel_data > skimage.filters.threshold_otsu(
          image.pixel_data
      )
  
      image_set.add(
          "input_image",
          cellprofiler_core.image.Image(
              image=input_image,
              convert=False,
              dimensions=image.dimensions,
          ),
      )
  
      module.run(workspace)
  
      actual = workspace.get_objects("watershed")
  
      # Generate expected output
      input_shape = input_image.shape
      if input_image.ndim > 2:
          # Only scale x and y
          factors = (1, downsample, downsample)
      else:
          factors = (downsample, downsample)
  
      footprint = 8
  
      if input_image.ndim == 3:
          maxima_footprint = numpy.ones(
              (footprint, footprint, footprint)
          )
      else:
          maxima_footprint = numpy.ones((footprint, footprint))
  
      input_image = skimage.transform.downscale_local_mean(
          input_image, factors
      )
      markers_image = skimage.transform.downscale_local_mean(
          markers_image, factors
      )
      intensity_image = skimage.transform.downscale_local_mean(
          intensity_image, factors
      )
      smoothed_input_image = skimage.filters.gaussian(
          input_image, sigma=gaussian_sigma
      )
      distance = scipy.ndimage.distance_transform_edt(
          smoothed_input_image
      )
      watershed_input_image = 1 - intensity_image
      strel = getattr(
          skimage.morphology, structuring_element.casefold()
      )(structuring_element_size)
  
      seeds = markers_image
      seeds = skimage.morphology.binary_dilation(seeds, strel)
  
      expected = skimage.segmentation.watershed(
          watershed_input_image,
          markers=seeds,
          mask=input_image != 0,
      )
      if downsample > 1:
          expected = skimage.transform.resize(
              expected,
              input_shape,
              mode="edge",
              order=0,
              preserve_range=True,
          )
          expected = numpy.rint(expected).astype(numpy.uint16)
  
      numpy.testing.assert_array_equal(actual.segmented, expected)
  
imports: import mahotas
  import numpy
  import numpy.testing
  import pytest
  import scipy.ndimage
  import skimage.color
  import skimage.feature
  import skimage.filters
  import skimage.filters.rank
  import skimage.segmentation
  import skimage.transform
  import cellprofiler_core.image
  import cellprofiler.modules.watershed
label_desc: Use image node_id 11 for calling a global function with example usage: test_run_markers_declump_intensity(image, module, image_set, workspace, downsample, gaussian_sigma) without return types