docstr: Convert one of the channel choice strings to a channel index
  
  choice - one of the strings from channel_choices or similar
           (string ending in a one-based index)
  returns the zero-based index of the channel.
docstr_tok: ["Convert","one","of","the","channel","choice","strings","to","a","channel","index","choice","-","one","of","the","strings","from","channel_choices","or","similar","(","string","ending","in","a","one-based","index",")","returns","the","zero-based","index","of","the","channel","."]
code: def get_channel_idx_from_choice(choice):
      """Convert one of the channel choice strings to a channel index
  
      choice - one of the strings from channel_choices or similar
               (string ending in a one-based index)
      returns the zero-based index of the channel.
      """
      if type(choice) == int:
          return choice - 1
      else:
          return int(re.search("[0-9]+$", choice).group()) - 1
  
imports: import re
  import matplotlib.colors
  import numpy
  from cellprofiler_core.image import Image
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import HiddenCount
  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
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.subscriber import ImageSubscriber
  from cellprofiler_core.setting.text import Float
  from cellprofiler_core.setting.text import ImageName
  from cellprofiler_core.setting.text import Integer
label_desc: Use image node_id 9 for calling the ColorToGray obj's underlying member method code with example usage: obj.get_channel_idx_from_choice(choice) and returns: unknown, unknown