Class HierarchicalVocabularyTree<Point>


public class HierarchicalVocabularyTree<Point> extends Object
A hierarchical tree which discretizes an N-Dimensional space. Each region in each node is defined by the set of points which have mean[i] as the closest mean. Once the region is known at a level the child node in the tree can then be looked up and the process repeated until it's at leaf.
  • Field Details

    • branchFactor

      public int branchFactor
      Number of children for each node
    • maximumLevel

      public int maximumLevel
      Maximum number of levels in the tree
    • distanceFunction

      public PointDistance<Point> distanceFunction
      Computes distance between two points. Together with the 'mean' points, this defines the sub-regions
    • descriptions

      public final PackedArray<Point> descriptions
    • nodes

  • Constructor Details

  • Method Details

    • addNode

      public int addNode(int parentIndex, int branch, Point desc)
      Adds a new node to the graph and returns its index
      parentIndex - Index of parent node.
      branch - Which branch off the parent does it map to.
      desc - The mean/description for this region
      Index of the newly added node
    • searchPathToLeaf

      public int searchPathToLeaf(Point point, BoofLambdas.ProcessIndex<HierarchicalVocabularyTree.Node> op)
      Traverses the tree to find the leaf node for the provided point. As it traverses the tree each node it passes through is passed to 'op'. Index of the leaf node is returned. The root node is not passed in since all points belong to it.
      point - (Input) Point
      op - Traversed nodes are passed to this function from level 0 to the leaf
      index of the leaf node
    • traverseGraphDepthFirst

      public void traverseGraphDepthFirst(BoofLambdas.ProcessObject<HierarchicalVocabularyTree.Node> op)
      Traverses every node in the graph (excluding the root) in a depth first manor.
      op - Every node is feed into this function
    • depthOfNode

      public int depthOfNode(HierarchicalVocabularyTree.Node n)
      Finds the depth for a node. The depth is the number of hops away it is from the root node
    • checkConfig

      public void checkConfig()
      Ensures it has a valid configuration
    • reset

      public void reset()
      Clears references to initial state but keeps allocated memory