code: def test_trace_loop():
      """Trace an object that loops on itself"""
      module = cellprofiler.modules.untangleworms.UntangleWorms()
      image = numpy.zeros((10, 20), bool)
      image[1:-1, 1:-1] = True
      image[2:-2, 2:-2] = False
      # Lop off the corners as would happen if skeletonized
      image[1, 1] = image[1, -2] = image[-2, 1] = image[-2, -2] = False
      #
      # It should go clockwise, starting from 1,2
      #
      expected_order = numpy.zeros(image.shape, int)
      i, j = numpy.mgrid[0 : image.shape[0], 0 : image.shape[1]]
      slices = (
          (1, slice(2, -2)),
          (slice(2, -2), -2),
          (-2, slice(-3, 1, -1)),
          (slice(-3, 1, -1), 1),
      )
      ii, jj = numpy.array((2, 0), int)
      ii = numpy.hstack(
          [i[islice, jslice].flatten() for islice, jslice in slices]
      )
      jj = numpy.hstack(
          [j[islice, jslice].flatten() for islice, jslice in slices]
      )
      expected_order[ii, jj] = numpy.arange(len(ii))
      i, j, label, order, distance, count = module.trace_segments(image)
      result_order = numpy.zeros(image.shape, int)
      result_order[i, j] = order
      assert numpy.all(expected_order == result_order)
  
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 10 for calling a global function with example usage: test_trace_loop() without return types