skimage 0.17.2

ParametersReturnsBackRef
max_tree_local_maxima(image, connectivity=1, parent=None, tree_traverser=None)

The local maxima are defined as connected sets of pixels with equal gray level strictly greater than the gray levels of all pixels in direct neighborhood of the set. The function labels the local maxima.

Technically, the implementation is based on the max-tree representation of an image. The function is very efficient if the max-tree representation has already been computed. Otherwise, it is preferable to use the function local_maxima.

Parameters

image : ndarray

The input image for which the maxima are to be calculated.

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.

parent: ndarray, int64, optional :

The value of each pixel is the index of its parent in the ravelled array.

tree_traverser: 1D array, int64, optional :

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).

Returns

local_max : ndarray, uint64

Labeled local maxima of the image.

Determine all local maxima of the image.

See Also

skimage.morphology.local_maxima
skimage.morphology.max_tree

Examples

We create an image (quadratic function with a maximum in the center and 4 additional constant maxima.

This example is valid syntax, but we were not able to check execution
>>> w = 10
... x, y = np.mgrid[0:w,0:w]
... f = 20 - 0.2*((x - w/2)**2 + (y-w/2)**2)
... f[2:4,2:4] = 40; f[2:4,7:9] = 60; f[7:9,2:4] = 80; f[7:9,7:9] = 100
... f = f.astype(np.int)

We can calculate all local maxima:

This example is valid syntax, but we were not able to check execution
>>> maxima = max_tree_local_maxima(f)

The resulting image contains the labeled local maxima.

See :

Back References

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

skimage.morphology.max_tree.max_tree_local_maxima

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#582
type: <class 'function'>
Commit: