code: def test_load_v10():
      # Sorry about this overly-long pipeline, it seemed like we need to
      # revisit many of the choices.
      file = tests.frontend.modules.get_test_resources_directory(
          "identifyprimaryobjects/v10.pipeline"
      )
      with open(file, "r") as fd:
          data = fd.read()
  
      pipeline = cellprofiler_core.pipeline.Pipeline()
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.LoadException
          )
  
      pipeline.add_listener(callback)
      pipeline.load(io.StringIO(data))
      module = pipeline.modules()[4]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert module.x_name == "Channel0"
      assert module.y_name == "Cells"
      assert module.size_range.min == 15
      assert module.size_range.max == 45
      assert module.exclude_size
      assert module.exclude_border_objects
      assert (
          module.unclump_method
          == cellprofiler.modules.identifyprimaryobjects.UN_INTENSITY
      )
      assert (
          module.watershed_method
          == cellprofiler.modules.identifyprimaryobjects.WA_INTENSITY
      )
      assert module.automatic_smoothing
      assert module.smoothing_filter_size == 11
      assert module.automatic_suppression
      assert module.maxima_suppression_size == 9
      assert module.low_res_maxima
      assert (
          module.fill_holes
          == cellprofiler.modules.identifyprimaryobjects.FH_THRESHOLDING
      )
      assert (
          module.limit_choice
          == cellprofiler.modules.identifyprimaryobjects.LIMIT_NONE
      )
      assert module.maximum_object_count == 499
      #
      assert module.threshold.threshold_scope == TS_ADAPTIVE
      assert (
          module.threshold.local_operation.value
          == centrosome.threshold.TM_OTSU
      )
      assert module.threshold.threshold_smoothing_scale == 1.3488
      assert (
          round(
              abs(
                  module.threshold.threshold_correction_factor.value
                  - 0.80
              ),
              7,
          )
          == 0
      )
      assert (
          round(abs(module.threshold.threshold_range.min - 0.01), 7)
          == 0
      )
      assert (
          round(abs(module.threshold.threshold_range.max - 0.90), 7)
          == 0
      )
      assert (
          round(abs(module.threshold.manual_threshold.value - 0.03), 7)
          == 0
      )
      assert (
          module.threshold.thresholding_measurement
          == "Metadata_Threshold"
      )
      assert module.threshold.two_class_otsu == O_TWO_CLASS
      assert (
          module.threshold.assign_middle_to_foreground == O_FOREGROUND
      )
      assert module.threshold.adaptive_window_size == 12
      #
      # Test alternate settings using subsequent instances of IDPrimary
      #
      module = pipeline.modules()[5]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert not module.exclude_size
      assert not module.exclude_border_objects
      assert (
          module.unclump_method
          == cellprofiler.modules.identifyprimaryobjects.UN_INTENSITY
      )
      assert (
          module.watershed_method
          == cellprofiler.modules.identifyprimaryobjects.WA_NONE
      )
      assert not module.automatic_smoothing
      assert not module.automatic_suppression
      assert not module.low_res_maxima
      assert (
          module.fill_holes
          == cellprofiler.modules.identifyprimaryobjects.FH_NEVER
      )
      assert (
          module.limit_choice
          == cellprofiler.modules.identifyprimaryobjects.LIMIT_ERASE
      )
      assert module.threshold.threshold_scope == TS_GLOBAL
      assert (
          module.threshold.global_operation.value
          == cellprofiler.modules.threshold.TM_LI
      )
      assert module.threshold.two_class_otsu == O_THREE_CLASS
      assert (
          module.threshold.assign_middle_to_foreground == O_BACKGROUND
      )
      assert module.use_advanced.value
  
      module = pipeline.modules()[6]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert (
          module.unclump_method
          == cellprofiler.modules.identifyprimaryobjects.UN_NONE
      )
      assert (
          module.watershed_method
          == cellprofiler.modules.identifyprimaryobjects.WA_PROPAGATE
      )
      assert module.limit_choice == "None"
      assert module.threshold.global_operation.value == "None"
      assert module.threshold.threshold_smoothing_scale == 0
      assert module.use_advanced.value
  
      module = pipeline.modules()[7]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert (
          module.unclump_method
          == cellprofiler.modules.identifyprimaryobjects.UN_SHAPE
      )
      assert (
          module.watershed_method
          == cellprofiler.modules.identifyprimaryobjects.WA_SHAPE
      )
      assert module.threshold.threshold_scope == TS_GLOBAL
      assert (
          module.threshold.global_operation.value
          == cellprofiler.modules.threshold.TM_ROBUST_BACKGROUND
      )
      assert module.threshold.lower_outlier_fraction.value == 0.02
      assert module.threshold.upper_outlier_fraction.value == 0.02
      assert module.threshold.averaging_method.value == RB_MODE
      assert module.threshold.variance_method.value == RB_SD
      assert module.threshold.number_of_deviations.value == 0
      assert module.threshold.threshold_correction_factor.value == 1.6
      assert module.use_advanced.value
  
      module = pipeline.modules()[8]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert (
          module.threshold.threshold_scope
          == cellprofiler.modules.threshold.TS_GLOBAL
      )
      assert (
          module.threshold.global_operation.value
          == cellprofiler.modules.threshold.TM_MANUAL
      )
      assert module.use_advanced.value
  
      module = pipeline.modules()[9]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert (
          module.threshold.threshold_scope
          == cellprofiler.modules.threshold.TS_GLOBAL
      )
      assert (
          module.threshold.global_operation.value
          == cellprofiler.modules.threshold.TM_MEASUREMENT
      )
      assert module.use_advanced.value
  
      module = pipeline.modules()[10]
      assert isinstance(
          module,
          cellprofiler.modules.identifyprimaryobjects.IdentifyPrimaryObjects,
      )
      assert module.threshold.threshold_scope == "None"
      assert (
          module.threshold.global_operation.value
          == cellprofiler.modules.threshold.TM_ROBUST_BACKGROUND
      )
      assert module.threshold.lower_outlier_fraction == 0.05
      assert module.threshold.upper_outlier_fraction == 0.05
      assert module.threshold.averaging_method == RB_MEAN
      assert module.threshold.variance_method == RB_SD
      assert module.threshold.number_of_deviations == 2
      assert module.use_advanced.value
  
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 24 for calling a global function with example usage: test_load_v10() without return types