Class ComponentTree<T>

java.lang.Object
imagingbook.common.mser.components.ComponentTree<T>
Type Parameters:
T - the data type of components (e.g., MserData)
All Implemented Interfaces:
Iterable<Component<T>>
Direct Known Subclasses:
ComponentTreeGlobalImmersion, ComponentTreeLinearTime

public abstract class ComponentTree<T> extends Object implements Iterable<Component<T>>
This class represents a tree of extremal image components.
Version:
2022/11/19
  • Method Details

    • from

      public static <T> ComponentTree<T> from(ByteProcessor ip)
      Creates a new component tree for the specified image using the default method (ComponentTree.Method.LinearTime).
      Type Parameters:
      T - the generic node type
      Parameters:
      ip - the input image
      Returns:
      the component tree for the specified image
    • from

      public static <T> ComponentTree<T> from(ByteProcessor ip, ComponentTree.Method method)
      Creates a new component tree for the specified image.
      Type Parameters:
      T - the data type of components (e.g., MserData)
      Parameters:
      ip - the input (gray-level) image
      method - the method for building the component tree
      Returns:
      the component tree
    • from

      public static <T> ComponentTree<T> from(PixelMap pm, ComponentTree.Method method)
      Creates a new component tree for the specified PixelMap.
      Type Parameters:
      T - the data type of components (e.g., MserData)
      Parameters:
      pm - a PixelMap instance
      method - the method for building the component tree
      Returns:
      the component tree
    • getRoot

      public abstract Component<T> getRoot()
      Returns the root component of this component tree. To be implemented by concrete subclasses.
      Returns:
      the root component
    • getComponents

      public abstract Collection<Component<T>> getComponents()
      Returns an unordered collection of all tree components. To be implemented by concrete subclasses.
      Returns:
      all tree components
    • iterator

      Specified by:
      iterator in interface Iterable<T>
    • getLeaves

      Finds and returns a collection of all leaf components of this tree. A leaf is a component which has no children.
      Returns:
      all leaf components
    • validate

      public boolean validate()
      Performs integrity checks on this component tree.
      Returns:
      true iff all checks are passed
    • toString

      public String toString()
      Overrides:
      toString in class Object