class_docstr: A tree choice chooses one path to a leaf in a tree
  
  Trees are represented as collections of two-tuples. The first element is
  the name of the node and the second is either None if a leaf or
  a sub-collection of two-tuples. For instance:
  (("Foo", (("1", None),("2", None))), ("Bar", None))
  is a tree for selecting ("Foo", "1"), ("Foo", "2") or ("Bar",).
  
  A good UI choice would be a hierarchical menu.
docstr: Initializer
  
  text - informative label
  
  value - the text value, e.g., as encoded by encode_path_parts
  
  tree - the tree to chose from
  
  fn_is_leaf - if defined, a function that takes a tree node and
               returns True if that node is a leaf (a node might
               have subnodes, but also be a leaf)
docstr_tok: ["Initializer","text","-","informative","label","value","-","the","text","value",",","e.g.",",","as","encoded","by","encode_path_parts","tree","-","the","tree","to","chose","from","fn_is_leaf","-","if","defined",",","a","function","that","takes","a","tree","node","and","returns","True","if","that","node","is","a","leaf","(","a","node","might","have","subnodes",",","but","also","be","a","leaf",")"]
code: def __init__(self, text, value, tree, fn_is_leaf=None, **kwargs):
      """Initializer
  
      text - informative label
  
      value - the text value, e.g., as encoded by encode_path_parts
  
      tree - the tree to chose from
  
      fn_is_leaf - if defined, a function that takes a tree node and
                   returns True if that node is a leaf (a node might
                   have subnodes, but also be a leaf)
      """
      super(TreeChoice, self).__init__(text, value, **kwargs)
      self.__tree = tree
      self.fn_is_leaf = fn_is_leaf or self.default_fn_is_leaf
  
file_path: CellProfiler/src/subpackages/core/cellprofiler_core/setting/_tree_choice.py
imports: import re
  from ._setting import Setting
  from ._validation_error import ValidationError
label_desc: Use image node_id 1 to create a new TreeChoice object from inherited base classes: Setting with example: obj = TreeChoice(text, value, tree, fn_is_leaf)