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: Get all leaf nodes of a given parent node
  
  path - the names of nodes traversing the path down the tree
docstr_tok: ["Get","all","leaf","nodes","of","a","given","parent","node","path","-","the","names","of","nodes","traversing","the","path","down","the","tree"]
code: def get_leaves(self, path=None):
      """Get all leaf nodes of a given parent node
  
      path - the names of nodes traversing the path down the tree
      """
      if path is None:
          path = []
      current = self.get_tree()
      while len(path) > 0:
          idx = current.index(path[0])
          if (
              idx == -1
              or current[idx][1] is None
              or len(current[idx][1]) == 0
          ):
              return []
          current = current[idx][1]
          path = path[1:]
      return [x[0] for x in current if x[1] is None or len(x[1] == 0)]
  
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 5 for calling the TreeChoice obj's underlying member method code with example usage: obj.get_leaves(path) and returns: unknown, list