|
mmcfilters
Public API documentation
|
This guide accompanies “The Extremum Residual Tree: A Self-Dual Morphological Tree Based on Levelings”, prepared for submission to DGMM.
See Illustrating Attribute Filtering with the Extremum Residual Tree and the Tree of Shapes for the Figure 1 example and attribute filtering on the cell image.
Install the library from the repository root:
Python accepts two-dimensional, C-contiguous np.uint8 images. This example uses the nine-point signal from Figure 1 as a one-row image:
A radius of 1.0 gives 4-adjacency on a two-dimensional image and chain adjacency on this one-row example. A radius of 1.5 gives 8-adjacency. An explicit symmetric RegularGridAdjacency2D can also be supplied. See the Python API guide for the overloads.
The corresponding C++ example uses camelCase identifiers:
The image owns the buffer passed to fromRaw and releases it with delete[]. The result is a ValuedMorphologicalTree<T>. C++ supports the altitude types accepted by the factory; the Python image contract above is more restrictive. Both interfaces use increasing row-major pixel identifiers as the fixed spatial order for equal-cardinality extrema.
Algorithm 1 maintains a max-tree and a min-tree of the current image. A current extremal flat zone is a leaf proper part in one of these trees, as in Eq. (29). ExtremumResidualTreeByCTsBuilder::build(image) constructs the initial pair as temporary state, then repeats the selection, recording, leveling, and pending support updates until the image is constant. It returns an independent NativeHierarchyOwned<T> with owned adjacency metadata. The factory materializes this result as a ValuedMorphologicalTree<T>.
| Algorithm 1 | Implementation responsibility |
|---|---|
| Line 1: build the initial component trees | ExtremumResidualTreeByCTsBuilder::build(image), using ComponentTreeBuilder and the shared native-hierarchy materialization |
| Lines 2–5: initialize and select the smallest current extremum | ExtremumAgenda::initialize, ExtremumAgenda::next, and SelectedSupport::collectFromLeaf |
| Lines 6–11: record the support and attach pending children | ResidualTreeConstruction::addSelectedSupport |
| Line 12: apply the elementary leveling | ExtremumResidualTreeByCTsBuilder::applyElementaryLeveling, using DualMinMaxTreeIncrementalFilterLeaf.hpp |
| Line 13: update pending supports in both component trees | ResidualTreeConstruction::updatePendingSupports, using transfers reported by the component-tree updater |
| Line 14: advance the scale index | The number of recorded nonterminal supports determines the next step |
| Lines 16–18: complete the terminal root and attach remaining supports | ResidualTreeConstruction::completeTree |
The algorithm is implemented by one public class, ExtremumResidualTreeByCTsBuilder.