code: def binary_image_to_grayscale(binary_image):
      data = numpy.random.randint(0, 128, binary_image.shape).astype(
          numpy.uint8
      )
  
      foreground = numpy.random.randint(
          128, 256, binary_image.shape
      ).astype(numpy.uint8)
  
      data[binary_image] = foreground[binary_image]
  
      return data
  
file_path: CellProfiler/tests/frontend/modules/test_convertboolimagetoobjects.py
imports: import numpy
  import numpy.random
  import pytest
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, M_LOCATION_CENTER_Z, M_NUMBER_OBJECT_NUMBER, FF_COUNT
  import cellprofiler.modules.convertimagetoobjects
label_desc: Use image node_id 3 for calling a global function with example usage: binary_image_to_grayscale(binary_image) and returns: data