code: def object_with_data(image):
      data = image.pixel_data
  
      if image.multichannel:
          data = skimage.color.rgb2gray(data)
  
      binary = data > skimage.filters.threshold_li(data)
  
      labels = skimage.measure.label(binary)
  
      objects = cellprofiler_core.object.Objects()
  
      objects.segmented = labels
      objects.parent_image = image
  
      return objects
  
imports: import numpy
  import pytest
  import skimage.data
  import skimage.color
  import skimage.filters
  import skimage.measure
  import cellprofiler.__main__
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.utilities.java
  import cellprofiler_core.workspace
label_desc: Use image node_id 18 for calling a global function with example usage: object_with_data(image) and returns: objects