code: def test_3D_half_overlap():
      ground_truth_image_data = numpy.zeros(
          (10, 100, 100), dtype=numpy.bool_
      )
      ground_truth_image_data[2:7, 30:40, 30:40] = True
      ground_truth_image_data[8, 10:20, 10:20] = True
      ground_truth_image_data[1:5, 50:60, 50:60] = True
  
      test_image_data = numpy.zeros((10, 100, 100), dtype=numpy.bool_)
      test_image_data[2:7, 35:45, 30:40] = True
      test_image_data[8, 10:20, 15:25] = True
      test_image_data[3:7, 50:60, 50:60] = True
  
      workspace, module = make_workspace(
          ground_truth={"image": ground_truth_image_data},
          test={"image": test_image_data},
          dimensions=3,
      )
  
      module.run(workspace)
  
      measurements = workspace.measurements
  
      ftr_true_pos_rate = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_TRUE_POS_RATE
      )
      ftr_true_pos_rate_measurement = (
          measurements.get_current_image_measurement(ftr_true_pos_rate)
      )
      assert round(abs(ftr_true_pos_rate_measurement - 0.5), 7) == 0
  
      ftr_false_pos_rate = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_FALSE_POS_RATE
      )
      ftr_false_pos_rate_measurement = (
          measurements.get_current_image_measurement(ftr_false_pos_rate)
      )
      assert (
          round(abs(ftr_false_pos_rate_measurement - 0.005050505), 7)
          == 0
      )
  
      ftr_true_neg_rate = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_TRUE_NEG_RATE
      )
      ftr_true_neg_rate_measurement = (
          measurements.get_current_image_measurement(ftr_true_neg_rate)
      )
      assert (
          round(abs(ftr_true_neg_rate_measurement - 0.99494949), 7) == 0
      )
  
      ftr_false_neg_rate = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_FALSE_NEG_RATE
      )
      ftr_false_neg_rate_measurement = (
          measurements.get_current_image_measurement(ftr_false_neg_rate)
      )
      assert round(abs(ftr_false_neg_rate_measurement - 0.5), 7) == 0
  
      ftr_precision = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_PRECISION
      )
      ftr_precision_measurement = (
          measurements.get_current_image_measurement(ftr_precision)
      )
      assert round(abs(ftr_precision_measurement - 0.5), 7) == 0
  
      ftr_recall = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_RECALL
      )
      ftr_recall_measurement = (
          measurements.get_current_image_measurement(ftr_recall)
      )
      assert round(abs(ftr_recall_measurement - 0.5), 7) == 0
  
      ftr_F_factor = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_F_FACTOR
      )
      ftr_F_factor_measurement = (
          measurements.get_current_image_measurement(ftr_F_factor)
      )
      assert round(abs(ftr_F_factor_measurement - 0.5), 7) == 0
  
      ftr_Earth_Movers_Distance = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_EARTH_MOVERS_DISTANCE
      )
      ftr_Earth_Movers_Distance_measurement = (
          measurements.get_current_image_measurement(
              ftr_Earth_Movers_Distance
          )
      )
      # test within 0.1% because sklearn keeps changing things so this kinda breaks
      assert (
          abs(ftr_Earth_Movers_Distance_measurement - 52921) / 52921
          <= 0.001
      )
  
      ftr_rand_index = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_RAND_INDEX
      )
      ftr_rand_index_measurement = (
          measurements.get_current_image_measurement(ftr_rand_index)
      )
      assert (
          round(abs(ftr_rand_index_measurement - 0.980199801998020), 2)
          == 0
      )
  
      ftr_adj_rand_index = module.measurement_name(
          cellprofiler.modules.measureimageoverlap.FTR_ADJUSTED_RAND_INDEX
      )
      ftr_adj_rand_index_measurement = (
          measurements.get_current_image_measurement(ftr_adj_rand_index)
      )
      numpy.testing.assert_almost_equal(
          ftr_adj_rand_index_measurement, 0.5, 2
      )
  
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 31 for calling a global function with example usage: test_3D_half_overlap() without return types