code: def make_workspace(
      control_points, lengths, radii, image, mask=None, auximage=None
  ):
      """Create a workspace containing the control point measurements
  
      control_points - an n x 2 x m array where n is the # of control points,
                          and m is the number of objects.
      lengths - the length of each object
      radii - the radii_from_training defining the radius at each control pt
      image - the image to be straightened
      mask - the mask associated with the image (default = no mask)
      auximage - a second image to be straightnened (default = no second image)
      """
      module = cellprofiler.modules.straightenworms.StraightenWorms()
      module.objects_name.value = OBJECTS_NAME
      module.straightened_objects_name.value = STRAIGHTENED_OBJECTS_NAME
      module.images[0].image_name.value = IMAGE_NAME
      module.images[
          0
      ].straightened_image_name.value = STRAIGHTENED_IMAGE_NAME
      module.flip_image.value = IMAGE_NAME
      module.set_module_num(1)
  
      # Trick the module into thinking it's read the data file
  
      class P:
          def __init__(self):
              self.radii_from_training = radii
  
      module.training_set_directory.dir_choice = (
          cellprofiler_core.preferences.URL_FOLDER_NAME
      )
      module.training_set_directory.custom_path = (
          "http://www.cellprofiler.org"
      )
      module.training_set_file_name.value = "TrainingSet.xml"
      module.training_params = {"TrainingSet.xml": (P(), "URL")}
  
      pipeline = cellprofiler_core.pipeline.Pipeline()
      pipeline.add_module(module)
  
      def callback(caller, event):
          assert not isinstance(
              event, cellprofiler_core.pipeline.event.RunException
          )
  
      pipeline.add_listener(callback)
  
      m = cellprofiler_core.measurement.Measurements()
      for i, (y, x) in enumerate(control_points):
          for v, f in (
              (
                  x,
                  cellprofiler.modules.straightenworms.F_CONTROL_POINT_X,
              ),
              (
                  y,
                  cellprofiler.modules.straightenworms.F_CONTROL_POINT_Y,
              ),
          ):
              feature = "_".join(
                  (
                      cellprofiler.modules.straightenworms.C_WORM,
                      f,
                      str(i + 1),
                  )
              )
              m.add_measurement(OBJECTS_NAME, feature, v)
      feature = "_".join(
          (
              cellprofiler.modules.straightenworms.C_WORM,
              cellprofiler.modules.straightenworms.F_LENGTH,
          )
      )
      m.add_measurement(OBJECTS_NAME, feature, lengths)
  
      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, mask)
      )
  
      if auximage is not None:
          image_set.add(
              AUX_IMAGE_NAME, cellprofiler_core.image.Image(auximage)
          )
          module.add_image()
          module.images[1].image_name.value = AUX_IMAGE_NAME
          module.images[
              1
          ].straightened_image_name.value = AUX_STRAIGHTENED_IMAGE_NAME
  
      object_set = cellprofiler_core.object.ObjectSet()
      objects = cellprofiler_core.object.Objects()
      labels = numpy.zeros(image.shape, int)
      for i in range(control_points.shape[2]):
          if lengths[i] == 0:
              continue
          rebuild_worm_from_control_points_approx(
              control_points[:, :, i], radii, labels, i + 1
          )
      objects.segmented = labels
  
      object_set.add_objects(objects, OBJECTS_NAME)
  
      workspace = cellprofiler_core.workspace.Workspace(
          pipeline, module, image_set, object_set, m, image_set_list
      )
      return workspace, module
  
imports: import centrosome.cpmorphology
  import numpy
  import six.moves
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.modules
  from cellprofiler_core.constants.measurement import C_COUNT, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, M_NUMBER_OBJECT_NUMBER, C_LOCATION, C_NUMBER, FTR_CENTER_X, FTR_CENTER_Y, FTR_OBJECT_NUMBER, COLTYPE_FLOAT
  import cellprofiler.modules.straightenworms
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import cellprofiler_core.preferences
  import tests.frontend.modules
label_desc: Use image node_id 3 for calling a global function with example usage: make_workspace(control_points, lengths, radii, image, mask, auximage) and returns: workspace,  module