code: def test_test_objects_rand_index():
      r = numpy.random.RandomState()
      r.seed(52)
      base = numpy.zeros((100, 100), bool)
      base[
          r.randint(0, 100, size=10), r.randint(0, 100, size=10)
      ] = True
      gt = base.copy()
      gt[r.randint(0, 100, size=5), r.randint(0, 100, size=5)] = True
      test = base.copy()
      test[r.randint(0, 100, size=5), r.randint(0, 100, size=5)] = True
      gt = scipy.ndimage.binary_dilation(gt, numpy.ones((5, 5), bool))
      test = scipy.ndimage.binary_dilation(
          test, numpy.ones((5, 5), bool)
      )
      workspace, module = make_workspace(
          dict(image=gt), dict(image=test)
      )
      module.wants_emd.value = False
      module.run(workspace)
  
      measurements = workspace.measurements
      mname = "_".join(
          (
              cellprofiler.modules.measureimageoverlap.C_IMAGE_OVERLAP,
              cellprofiler.modules.measureimageoverlap.FTR_RAND_INDEX,
              TEST_IMAGE_NAME,
          )
      )
      expected_rand_index = measurements.get_current_image_measurement(
          mname
      )
      mname = "_".join(
          (
              cellprofiler.modules.measureimageoverlap.C_IMAGE_OVERLAP,
              cellprofiler.modules.measureimageoverlap.FTR_ADJUSTED_RAND_INDEX,
              TEST_IMAGE_NAME,
          )
      )
      expected_adjusted_rand_index = (
          measurements.get_current_image_measurement(mname)
      )
  
imports: import io
  import numpy
  import numpy.random
  import numpy.testing
  import scipy.ndimage
  import cellprofiler_library.opts.measureimageoverlap
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.module
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.workspace
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  import cellprofiler.modules.measureimageoverlap
  import tests.frontend.modules
label_desc: Use image node_id 22 for calling a global function with example usage: test_test_objects_rand_index() without return types