code: def create_settings(self):
      self.object_name = LabelSubscriber(
          "Select objects to measure",
          "None",
          doc="""\
  Select the objects whose neighbors you want to measure.""",
      )
  
      self.neighbors_name = LabelSubscriber(
          "Select neighboring objects to measure",
          "None",
          doc="""\
  This is the name of the objects that are potential
  neighbors of the above objects. You can find the neighbors
  within the same set of objects by selecting the same objects
  as above.""",
      )
  
      self.distance_method = Choice(
          "Method to determine neighbors",
          D_ALL,
          D_EXPAND,
          doc="""\
  There are several methods by which to determine whether objects are
  neighbors:
  
  -  *%(D_ADJACENT)s:* In this mode, two objects must have adjacent
     boundary pixels to be neighbors.
  -  *%(D_EXPAND)s:* The objects are expanded until all pixels on the
     object boundaries are touching another. Two objects are neighbors if
     any of their boundary pixels are adjacent after expansion.
  -  *%(D_WITHIN)s:* Each object is expanded by the number of pixels you
     specify. Two objects are neighbors if they have adjacent pixels after
     expansion. Note that *all* objects are expanded by this amount (e.g., 
     if this distance is set to 10, a pair of objects will count as 
     neighbors if their edges are 20 pixels apart or closer).
  
  For *%(D_ADJACENT)s* and *%(D_EXPAND)s*, the
  *%(M_PERCENT_TOUCHING)s* measurement is the percentage of pixels on
  the boundary of an object that touch adjacent objects. For
  *%(D_WITHIN)s*, two objects are touching if any of their boundary
  pixels are adjacent after expansion and *%(M_PERCENT_TOUCHING)s*
  measures the percentage of boundary pixels of an *expanded* object that
  touch adjacent objects.
  """
          % globals(),
      )
  
      self.distance = Integer(
          "Neighbor distance",
          5,
          1,
          doc="""\
  *(Used only when “%(D_WITHIN)s” is selected)*
  
  The Neighbor distance is the number of pixels that each object is
  expanded for the neighbor calculation. Expanded objects that touch are
  considered neighbors.
  """
          % globals(),
      )
  
      self.wants_count_image = Binary(
          "Retain the image of objects colored by numbers of neighbors?",
          False,
          doc="""\
  An output image showing the input objects colored by numbers of
  neighbors may be retained. A colormap of your choice shows how many
  neighbors each object has. The background is set to -1. Objects are
  colored with an increasing color value corresponding to the number of
  neighbors, such that objects with no neighbors are given a color
  corresponding to 0. Use the **SaveImages** module to save this image to
  a file.""",
      )
  
      self.count_image_name = ImageName(
          "Name the output image",
          "ObjectNeighborCount",
          doc="""\
  *(Used only if the image of objects colored by numbers of neighbors is
  to be retained for later use in the pipeline)*
  
  Specify a name that will allow the image of objects colored by numbers
  of neighbors to be selected later in the pipeline.""",
      )
  
      self.count_colormap = Colormap(
          "Select colormap",
          value="Blues",
          doc="""\
  *(Used only if the image of objects colored by numbers of neighbors is
  to be retained for later use in the pipeline)*
  
  Select the colormap to use to color the neighbor number image. All
  available colormaps can be seen `here`_.
  
  .. _here: http://matplotlib.org/examples/color/colormaps_reference.html""",
      )
  
      self.wants_percent_touching_image = Binary(
          "Retain the image of objects colored by percent of touching pixels?",
          False,
          doc="""\
  Select *Yes* to keep an image of the input objects colored by the
  percentage of the boundary touching their neighbors. A colormap of your
  choice is used to show the touching percentage of each object. Use the
  **SaveImages** module to save this image to a file.
  """
          % globals(),
      )
  
      self.touching_image_name = ImageName(
          "Name the output image",
          "PercentTouching",
          doc="""\
  *(Used only if the image of objects colored by percent touching is to be
  retained for later use in the pipeline)*
  
  Specify a name that will allow the image of objects colored by percent
  of touching pixels to be selected later in the pipeline.""",
      )
  
      self.touching_colormap = Colormap(
          "Select colormap",
          value="Oranges",
          doc="""\
  *(Used only if the image of objects colored by percent touching is to be
  retained for later use in the pipeline)*
  
  Select the colormap to use to color the percent touching image. All
  available colormaps can be seen `here`_.
  
  .. _here: http://matplotlib.org/examples/color/colormaps_reference.html""",
      )
  
      self.wants_excluded_objects = Binary(
          "Consider objects discarded for touching image border?",
          True,
          doc="""\
  When set to *{YES}*, objects which were previously discarded for touching
  the image borders will be considered as potential object neighbours in this
  analysis. You may want to disable this if using object sets which were
  further filtered, since those filters won't have been applied to the
  previously discarded objects.""".format(
              **{"YES": "Yes"}
          ),
      )
  
imports: import matplotlib.cm
  import numpy
  import scipy.ndimage
  import scipy.signal
  import skimage.morphology
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.constants.measurement import COLTYPE_INTEGER
  from cellprofiler_core.constants.measurement import MCA_AVAILABLE_EACH_CYCLE
  from cellprofiler_core.constants.measurement import NEIGHBORS
  from cellprofiler_core.image import Image
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.object import Objects
  from cellprofiler_core.preferences import get_default_colormap
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting.choice import Choice, Colormap
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import ImageName
  from cellprofiler_core.setting.text import Integer
  from cellprofiler_core.workspace import Workspace
  from centrosome.cpmorphology import fixup_scipy_ndimage_result
  from centrosome.cpmorphology import strel_disk, centers_of_labels
  from centrosome.outline import outline
label_desc: Use image node_id 1 for calling the MeasureObjectNeighbors obj's underlying member method code with example usage: obj.create_settings() without return types