code: def test_median_intensity_masked(
      image, measurements, module, objects, workspace
  ):
      numpy.random.seed(37)
  
      labels = numpy.ones((10, 10), int)
  
      mask = numpy.ones((10, 10), bool)
  
      mask[:, :5] = False
  
      pixel_data = numpy.random.uniform(size=(10, 10)).astype(
          numpy.float32
      )
  
      pixel_data[~mask] = 1
  
      image.pixel_data = pixel_data
  
      image.mask = mask
  
      objects.segmented = labels
  
      expected = numpy.sort(pixel_data[mask])[numpy.sum(mask) // 2]
  
      assert not expected == numpy.median(pixel_data)
  
      module.run(workspace)
  
      assert isinstance(
          measurements, cellprofiler_core.measurement.Measurements
      )
  
      values = measurements.get_current_measurement(
          OBJECT_NAME,
          "_".join(
              (
                  cellprofiler.modules.measureobjectintensity.INTENSITY,
                  cellprofiler.modules.measureobjectintensity.MEDIAN_INTENSITY,
                  IMAGE_NAME,
              )
          ),
      )
  
      assert len(values) == 1
  
      assert expected == values[0]
  
imports: import math
  import centrosome.outline
  import numpy
  import numpy.testing
  import pytest
  import skimage.measure
  import skimage.segmentation
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import EXPERIMENT, COLTYPE_FLOAT, C_LOCATION
  import cellprofiler.modules.measureobjectintensity
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.workspace
label_desc: Use image node_id 20 for calling a global function with example usage: test_median_intensity_masked(image, measurements, module, objects, workspace) without return types