hierarchy¶
Module for dealing with the Hierarchy data object.
- treesegmentation.hierarchy.calculate_hac(h)¶
Computes the height-adjusted centroid for each hierarchy. Follows the procedure described by the tree segmentation algorithm. This is used in the weighted graph creation to assign edge weights.
- Parameters
h – Hierarchy to calculate height-adjusted centroid
- Returns
The HAC and cell count of the hierarchy
- treesegmentation.hierarchy.compute_hierarchies(all_patches, patch_dict)¶
Compute the directed hierarchy graph from the Patch objects. This sets up a directed graph based on a given Patch’s neighbors. Does a traversal of each local maxima in the graph (parentless nodes) and sets up hierarchies as specified in the algorithm.
- Parameters
all_patches – The list of Patch objects from previous step of the algorithm
patch_dict – The dictionary of Patch objects
- Returns
a list of Hierarchy objects