code: def test_split_channels():
      numpy.random.seed(13)
      image = numpy.random.uniform(size=(20, 10, 5))
      image_set_list = cellprofiler_core.image.ImageSetList()
      image_set = image_set_list.get_image_set(0)
      image_set.add(IMAGE_NAME, cellprofiler_core.image.Image(image))
  
      module = cellprofiler.modules.colortogray.ColorToGray()
      module.set_module_num(1)
      module.image_name.value = IMAGE_NAME
      module.combine_or_split.value = (
          cellprofiler.modules.colortogray.SPLIT
      )
      module.rgb_or_channels.value = (
          cellprofiler.modules.colortogray.CH_CHANNELS
      )
      module.add_channel()
      module.add_channel()
      module.add_channel()
      module.add_channel()
  
      channel_indexes = numpy.array([1, 4, 2])
      for i, channel_index in enumerate(channel_indexes):
          module.channels[i].channel_choice.value = channel_index + 1
          module.channels[i].image_name.value = OUTPUT_IMAGE_F % i
  
      pipeline = cellprofiler_core.pipeline.Pipeline()
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.RunException
          )
  
      pipeline.add_listener(callback)
      pipeline.add_module(module)
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline,
          module,
          image_set,
          cellprofiler_core.object.ObjectSet(),
          cellprofiler_core.measurement.Measurements(),
          image_set_list,
      )
      module.run(workspace)
      for i, channel_index in enumerate(channel_indexes):
          pixels = image_set.get_image(
              module.channels[i].image_name.value
          ).pixel_data
          assert pixels.ndim == 2
          assert tuple(pixels.shape) == (20, 10)
          numpy.testing.assert_almost_equal(
              image[:, :, channel_index], pixels
          )
  
imports: import numpy
  import pytest
  import six.moves
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.colortogray
  import cellprofiler_core.modules.injectimage
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 6 for calling a global function with example usage: test_split_channels() without return types