docstr: Create the initial settings for the module
docstr_tok: ["Create","the","initial","settings","for","the","module"]
code: def create_settings(self):
      """Create the initial settings for the module"""
  
      self.images_list = ImageListSubscriber(
          "Select images to measure",
          [],
          doc="""Select images to measure the correlation/colocalization in.""",
      )
  
      self.objects_list = LabelListSubscriber(
          "Select objects to measure",
          [],
          doc="""\
  *(Used only when "Within objects" or "Both" are selected)*
  
  Select the objects to be measured.""",
      )
  
      self.thr = Float(
          "Set threshold as percentage of maximum intensity for the images",
          15,
          minval=0,
          maxval=99,
          doc="""\
  You may choose to measure colocalization metrics only for those pixels above 
  a certain threshold. Select the threshold as a percentage of the maximum intensity 
  of the above image [0-99].
  
  This value is used by the Overlap, Manders, and Rank Weighted Colocalization 
  measurements.
  """,
      )
  
      self.images_or_objects = Choice(
          "Select where to measure correlation",
          [M_IMAGES, M_OBJECTS, M_IMAGES_AND_OBJECTS],
          doc="""\
  You can measure the correlation in several ways:
  
  -  *%(M_OBJECTS)s:* Measure correlation only in those pixels previously
     identified as within an object. You will be asked to choose which object
     type to measure within.
  -  *%(M_IMAGES)s:* Measure the correlation across all pixels in the
     images.
  -  *%(M_IMAGES_AND_OBJECTS)s:* Calculate both measurements above.
  
  All methods measure correlation on a pixel by pixel basis.
  """
          % globals(),
      )
  
      self.spacer = Divider(line=True)
  
      self.do_all = Binary(
          "Run all metrics?",
          True,
          doc="""\
  Select *{YES}* to run all of CellProfiler's correlation 
  and colocalization algorithms on your images and/or objects; 
  otherwise select *{NO}* to pick which correlation and 
  colocalization algorithms to run.
  """.format(
              **{"YES": "Yes", "NO": "No"}
          ),
      )
  
      self.do_corr_and_slope = Binary(
          "Calculate correlation and slope metrics?",
          True,
          doc="""\
  Select *{YES}* to run the Pearson correlation and slope metrics.
  """.format(
              **{"YES": "Yes"}
          ),
      )
  
      self.do_manders = Binary(
          "Calculate the Manders coefficients?",
          True,
          doc="""\
  Select *{YES}* to run the Manders coefficients.
  """.format(
              **{"YES": "Yes"}
          ),
      )
  
      self.do_rwc = Binary(
          "Calculate the Rank Weighted Colocalization coefficients?",
          True,
          doc="""\
  Select *{YES}* to run the Rank Weighted Colocalization coefficients.
  """.format(
              **{"YES": "Yes"}
          ),
      )
  
      self.do_overlap = Binary(
          "Calculate the Overlap coefficients?",
          True,
          doc="""\
  Select *{YES}* to run the Overlap coefficients.
  """.format(
              **{"YES": "Yes"}
          ),
      )
  
      self.do_costes = Binary(
          "Calculate the Manders coefficients using Costes auto threshold?",
          True,
          doc="""\
  Select *{YES}* to run the Manders coefficients using Costes auto threshold.
  """.format(
              **{"YES": "Yes"}
          ),
      )
  
      self.fast_costes = Choice(
          "Method for Costes thresholding",
          [M_FASTER, M_FAST, M_ACCURATE],
          doc=f"""\
  This setting determines the method used to calculate the threshold for use within the
  Costes calculations. The *{M_FAST}* and *{M_ACCURATE}* modes will test candidate thresholds
  in descending order until the optimal threshold is reached. Selecting *{M_FAST}* will attempt 
  to skip candidates when results are far from the optimal value being sought. Selecting *{M_ACCURATE}* 
  will test every possible threshold value. When working with 16-bit images these methods can be extremely 
  time-consuming. Selecting *{M_FASTER}* will use a modified bisection algorithm to find the threshold 
  using a shrinking window of candidates. This is substantially faster but may produce slightly lower 
  thresholds in exceptional circumstances.
  
  In the vast majority of instances the results of all strategies should be identical. We recommend using 
  *{M_FAST}* mode when working with 8-bit images and *{M_FASTER}* mode when using 16-bit images.
  
  Alternatively, you may want to disable these specific measurements entirely 
  (available when "*Run All Metrics?*" is set to "*No*").
  """,
      )
  
imports: import numpy
  import scipy.ndimage
  import scipy.stats
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Divider, Binary, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import LabelListSubscriber, ImageListSubscriber
  from cellprofiler_core.setting.text import Float
  from cellprofiler_core.utilities.core.object import size_similarly
  from centrosome.cpmorphology import fixup_scipy_ndimage_result
  from scipy.linalg import lstsq
label_desc: Use image node_id 1 for calling the MeasureColocalization obj's underlying member method code with example usage: obj.create_settings() without return types