code: def test_recalculate_single_worm_control_points():
      i, j = numpy.mgrid[0:10, 0:10]
      l0 = ((i == 3) & (j >= 2) & (j <= 6)).astype(int)
      l0[(i == 7) & (j >= 3) & (j <= 7)] = 3
  
      l1 = ((j == 3) & (i >= 2) & (i <= 6)).astype(int) * 2
      l1[(j == 7) & (i >= 3) & (i <= 7)] = 4
  
      expected = numpy.array(
          (
              ((3, 2), (3, 4), (3, 6)),
              ((2, 3), (4, 3), (6, 3)),
              ((7, 3), (7, 5), (7, 7)),
              ((3, 7), (5, 7), (7, 7)),
          )
      )
  
      (
          result,
          lengths,
      ) = cellprofiler.modules.untangleworms.recalculate_single_worm_control_points(
          [l0, l1], 3
      )
      assert tuple(result.shape) == (4, 3, 2)
      assert len(lengths) == 4
      # Flip any worms that aren't ordered canonically
      for i in range(4):
          if tuple(result[i, -1, :]) < tuple(result[i, 0, :]):
              result[i, :, :] = result[i, ::-1, :]
  
      assert numpy.all(lengths == 4)
      numpy.testing.assert_array_equal(expected, result)
  
imports: import base64
  import io
  import os
  import tempfile
  import zlib
  import imageio
  import centrosome.outline
  import numpy
  import scipy.ndimage
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.modules
  import cellprofiler.modules.untangleworms
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 42 for calling a global function with example usage: test_recalculate_single_worm_control_points() without return types