code: def add_flag(self, can_delete=True):
      group = SettingsGroup()
      group.append("divider1", Divider(line=False))
      group.append("measurement_settings", [])
      group.append(
          "measurement_count", HiddenCount(group.measurement_settings)
      )
      group.append(
          "category",
          Text(
              "Name the flag's category",
              "Metadata",
              doc="""\
  Name a measurement category by which to categorize the flag. The
  *Metadata* category is the default used in CellProfiler to store
  information about images (referred to as *metadata*).
  
  The flag is stored as a per-image measurement whose name is a
  combination of the flag’s category and the flag name that you choose, separated by
  underscores. For instance, if the measurement category is *Metadata* and
  the flag name is *QCFlag*, then the default measurement name would be
  *Metadata_QCFlag*.
  """,
          ),
      )
  
      group.append(
          "feature_name",
          Text(
              "Name the flag",
              "QCFlag",
              doc="""\
  The flag is stored as a per-image measurement whose name is a
  combination of the flag’s category and the flag name that you choose, separated by
  underscores. For instance, if the measurement category is *Metadata* and
  the flag name is *QCFlag*, then the default measurement name would be
  *Metadata_QCFlag*.
  """,
          ),
      )
  
      group.append(
          "combination_choice",
          Choice(
              "How should measurements be linked?",
              [C_ANY, C_ALL],
              doc="""\
  For combinations of measurements, you can set the criteria under which
  an image set is flagged:
  
  -  *%(C_ANY)s:* An image set will be flagged if any of its measurements
     fail. This can be useful for flagging images possessing multiple QC
     flaws; for example, you can flag all bright images and all out of
     focus images with one flag.
  -  *%(C_ALL)s:* A flag will only be assigned if all measurements fail.
     This can be useful for flagging images that possess only a
     combination of QC flaws; for example, you can flag only images that
     are both bright and out of focus.
  """
              % globals(),
          ),
      )
  
      group.append(
          "wants_skip",
          Binary(
              "Skip image set if flagged?",
              False,
              doc="""\
  Select *Yes* to skip the remainder of the pipeline for image sets
  that are flagged. CellProfiler will not run subsequent modules in the
  pipeline on the images for any image set that is flagged. Select *No*
  for CellProfiler to continue to process the pipeline regardless of
  flagging.
  
  You may want to skip processing in order to filter out unwanted images.
  For instance, you may want to exclude out of focus images when running
  **CorrectIllumination_Calculate**. You can do this with a pipeline that
  measures image quality and flags inappropriate images before it runs
  **CorrectIllumination_Calculate**.
  """
              % globals(),
          ),
      )
  
      group.append(
          "add_measurement_button",
          DoSomething(
              "",
              "Add another measurement",
              self.add_measurement,
              group,
              doc="""Add another measurement as a criteria.""",
          ),
      )
      self.add_measurement(group, False if not can_delete else True)
      if can_delete:
          group.append(
              "remover",
              RemoveSettingButton(
                  "", "Remove this flag", self.flags, group
              ),
          )
      group.append("divider2", Divider(line=True))
      self.flags.append(group)
  
imports: import logging
  import os
  import numpy
  from cellprofiler_core.constants.measurement import IMAGE, COLTYPE_INTEGER
  from cellprofiler_core.constants.module import IO_FOLDER_CHOICE_HELP_TEXT
  from cellprofiler_core.constants.workspace import DISPOSITION_CONTINUE, DISPOSITION_SKIP
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import HiddenCount
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.multichoice import MultiChoice
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import Text, Filename, Directory, Float
  from cellprofiler.utilities.rules import Rules
label_desc: Use image node_id 3 for calling the FlagImage obj's underlying member method code with example usage: obj.add_flag(can_delete) without return types