code: def test_splines_masked():
      #
      # Make an image with a random background
      #
      numpy.random.seed(37)
      image = numpy.random.uniform(size=(21, 31)) * 0.05
      #
      # Mask 1/2 of the pixels
      #
      mask = numpy.random.uniform(size=(21, 31)) < 0.5
      #
      # Make a background function
      #
      ii, jj = numpy.mgrid[-10:11, -15:16]
      bg = ((ii.astype(float) / 10) ** 2) * (
          (jj.astype(float) / 15) ** 2
      )
      bg *= 0.2
      image += bg
      #
      # Offset the background within the mask
      #
      image[~mask] += bg[~mask]
  
      workspaces, module = make_workspaces(((image, mask),))
      assert isinstance(
          module,
          cellprofiler.modules.correctilluminationcalculate.CorrectIlluminationCalculate,
      )
      module.intensity_choice.value = (
          cellprofiler.modules.correctilluminationcalculate.IC_BACKGROUND
      )
      module.each_or_all.value = (
          cellprofiler.modules.correctilluminationcalculate.EA_EACH
      )
      module.rescale_option.value = "No"
      module.smoothing_method.value = (
          cellprofiler.modules.correctilluminationcalculate.SM_SPLINES
      )
      module.automatic_splines.value = True
      module.prepare_group(workspaces[0], {}, [1])
      module.run(workspaces[0])
      img = workspaces[0].image_set.get_image(OUTPUT_IMAGE_NAME)
      pixel_data = img.pixel_data
      diff = pixel_data - numpy.min(pixel_data) - bg
      assert numpy.all(diff < 0.05)
      #
      # Make sure test fails w/o mask
      #
      workspaces, module = make_workspaces(((image, None),))
      assert isinstance(
          module,
          cellprofiler.modules.correctilluminationcalculate.CorrectIlluminationCalculate,
      )
      module.intensity_choice.value = (
          cellprofiler.modules.correctilluminationcalculate.IC_BACKGROUND
      )
      module.each_or_all.value = (
          cellprofiler.modules.correctilluminationcalculate.EA_EACH
      )
      module.rescale_option.value = "No"
      module.smoothing_method.value = (
          cellprofiler.modules.correctilluminationcalculate.SM_SPLINES
      )
      module.automatic_splines.value = True
      module.prepare_group(workspaces[0], {}, [1])
      module.run(workspaces[0])
      img = workspaces[0].image_set.get_image(OUTPUT_IMAGE_NAME)
      pixel_data = img.pixel_data
      diff = pixel_data - numpy.min(pixel_data) - bg
      assert not numpy.all(diff < 0.05)
  
imports: import numpy
  import pytest
  from centrosome.bg_compensate import MODE_AUTO, MODE_BRIGHT, MODE_DARK, MODE_GRAY
  from six.moves import StringIO
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.correctilluminationcalculate
  import cellprofiler_core.modules.injectimage
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 16 for calling a global function with example usage: test_splines_masked() without return types