code: def test_mass_displacement_masked(
      image, measurements, module, objects, workspace
  ):
      """Regression test IMG-766 - mass displacement of a masked image"""
      labels = numpy.array(
          [
              [0, 0, 0, 0, 0, 0, 0],
              [0, 1, 1, 1, 1, 1, 0],
              [0, 1, 1, 1, 1, 1, 0],
              [0, 1, 1, 1, 1, 1, 0],
              [0, 1, 1, 1, 1, 1, 0],
              [0, 1, 1, 1, 1, 1, 0],
              [0, 0, 0, 0, 0, 0, 0],
              [0, 2, 2, 2, 2, 2, 0],
              [0, 2, 2, 2, 2, 2, 0],
              [0, 2, 2, 2, 2, 2, 0],
              [0, 2, 2, 2, 2, 2, 0],
              [0, 2, 2, 2, 2, 2, 0],
              [0, 0, 0, 0, 0, 0, 0],
              [0, 3, 3, 3, 3, 3, 0],
              [0, 3, 3, 3, 3, 3, 0],
              [0, 3, 3, 3, 3, 3, 0],
              [0, 3, 3, 3, 3, 3, 0],
              [0, 3, 3, 3, 3, 3, 0],
              [0, 0, 0, 0, 0, 0, 0],
          ]
      )
  
      data = numpy.zeros(labels.shape, dtype=float)
  
      #
      # image # 1 has a single value in one of the corners
      # whose distance is sqrt(8) from the center
      #
      data[1, 1] = 1
  
      # image # 2 has a single value on the top edge
      # and should have distance 2
      #
      data[7, 3] = 1
  
      # image # 3 has a single value on the left edge
      # and should have distance 2
      data[15, 1] = 1
  
      mask = numpy.zeros(data.shape, bool)
  
      mask[labels > 0] = True
  
      image.pixel_data = data
  
      image.mask = mask
  
      objects.segmented = labels
  
      module.run(workspace)
  
      feature_name = "%s_%s_%s" % (
          cellprofiler.modules.measureobjectintensity.INTENSITY,
          cellprofiler.modules.measureobjectintensity.MASS_DISPLACEMENT,
          "MyImage",
      )
  
      mass_displacement = measurements.get_current_measurement(
          "MyObjects", feature_name
      )
  
      assert numpy.product(mass_displacement.shape) == 3
  
      numpy.testing.assert_almost_equal(
          mass_displacement[0], math.sqrt(8.0)
      )
  
      numpy.testing.assert_almost_equal(mass_displacement[1], 2.0)
  
      numpy.testing.assert_almost_equal(mass_displacement[2], 2.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 16 for calling a global function with example usage: test_mass_displacement_masked(image, measurements, module, objects, workspace) without return types