skimage 0.17.2

ParametersReturnsBackRef
max_tree(image, connectivity=1)

Component trees represent the hierarchical structure of the connected components resulting from sequential thresholding operations applied to an image. A connected component at one level is parent of a component at a higher level if the latter is included in the first. A max-tree is an efficient representation of a component tree. A connected component at one level is represented by one reference pixel at this level, which is parent to all other pixels at that level and to the reference pixel at the level above. The max-tree is the basis for many morphological operators, namely connected operators.

Parameters

image : ndarray

The input image for which the max-tree is to be calculated. This image can be of any type.

connectivity : unsigned int, optional

The neighborhood connectivity. The integer represents the maximum number of orthogonal steps to reach a neighbor. In 2D, it is 1 for a 4-neighborhood and 2 for a 8-neighborhood. Default value is 1.

Returns

parent : ndarray, int64

Array of same shape as image. The value of each pixel is the index of its parent in the ravelled array.

tree_traverser : 1D array, int64

The ordered pixel indices (referring to the ravelled array). The pixels are ordered such that every pixel is preceded by its parent (except for the root which has no parent).

Build the max tree from an image.

Examples

We create a small sample image (Figure 1 from [4]) and build the max-tree.

This example is valid syntax, but we were not able to check execution
>>> image = np.array([[15, 13, 16], [12, 12, 10], [16, 12, 14]])
... P, S = max_tree(image, connectivity=2)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.morphology.max_tree.diameter_closing skimage.morphology.max_tree.area_opening skimage.morphology.max_tree.max_tree_local_maxima skimage.morphology.max_tree.diameter_opening skimage.morphology.max_tree.area_closing skimage.morphology.max_tree.max_tree

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/morphology/max_tree.py#53
type: <class 'function'>
Commit: