|
mmcfilters
Public API documentation
|
Incremental updater for a paired min-tree / max-tree state. More...
#include <DualMinMaxTreeIncrementalFilter.hpp>
Public Member Functions | |
| DualMinMaxTreeIncrementalFilter (tree_t *mintree, tree_t *maxtree, const RegularGridAdjacency2D &graph) | |
| Creates an adjuster for externally owned min/max-tree states. | |
| void | setAttributeComputer (const attribute_computer_t &computerMin, const attribute_computer_t &computerMax, std::vector< double > &bufferMin, std::vector< double > &bufferMax) |
| Registers incremental attribute computers and their external buffers. | |
| void | setAttributeComputer (const attribute_computer_t &computer, std::vector< double > &bufferMin, std::vector< double > &bufferMax) |
| Registers one shared incremental attribute computer for both trees. | |
| void | pruneMaxTreeAndUpdateMinTree (const std::vector< NodeId > &nodesToPrune) |
| Prunes max-tree subtrees and updates the min-tree before each prune. | |
| void | pruneMinTreeAndUpdateMaxTree (const std::vector< NodeId > &nodesToPrune) |
| Prunes min-tree subtrees and updates the max-tree before each prune. | |
Static Public Member Functions | |
| static constexpr bool | usesDenseLevelBackend () |
| Reports whether this altitude type uses dense per-level buckets. | |
| static constexpr int | denseLevelBackendMaxBits () |
| Returns the bit-width threshold for dense bucket selection. | |
Incremental updater for a paired min-tree / max-tree state.
This class ports the Higra dual component-tree adjustment algorithm to this repository's ValuedMorphologicalTree<T> representation. It implements the update-rather-than-rebuild strategy used for efficient connected alternating sequential filters: when a rooted subtree is removed from one component tree, the dual tree is updated in place so both trees remain consistent with the same filtered image.
The algorithmic structure is intentionally kept the same:
C;C are collected in the dual tree;Public usage model:
pruneMaxTreeAndUpdateMinTree(...) or pruneMinTreeAndUpdateMaxTree(...).State managed by this class:
mintree_, maxtree_);Ownership and lifetime:
Representation notes:
ValuedMorphologicalTree<T>::nodeAltitude;ValuedMorphologicalTreeView boundary: topology, smallest-node mapping, owned altitude, and optional dynamic attributes are updated in lockstep;altitude_t template parameter is the owned tree altitude type and also controls merge-bucket keys/backends;ValuedMorphologicalTreeEditor<T> and publish with the generic move-only proof protocol; the update establishes its invariants during the existing algorithmic passes, while assertion-enabled builds retain the complete validation oracle;DynamicTreeAttributeComputer<std::uint8_t>.Internal notation follows the original adjustment routine:
nodeCa: implementation-side representative of the extremal node in the dual tree that contains the set C at level a;b: altitude of the parent of the subtree removed in the primal tree;frontierNodesAboveB: roots that leave the merge interval and are reattached when the sweep reaches the boundary level;properPartSetC_: pixels directly removed or relocated in the dual tree.Backend selection for mergeNodesByLevel:
MMCFILTERS_COMPONENT_TREE_ADJUSTMENT_DENSE_MAX_BITS bits;The expected cost remains local to the affected region. The dominant terms are the same as in the Higra implementation: collecting C, visiting adjacent seeds, climbing relevant ancestor chains once, sweeping the active altitude buckets, and contracting the nodes actually emptied by the step. The class never rebuilds the dual tree globally as part of an adjustment.
Definition at line 107 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inline |
Creates an adjuster for externally owned min/max-tree states.
| mintree | Mutable min-tree state. |
| maxtree | Mutable max-tree state. |
| graph | Shared image-domain adjacency relation. |
The constructor sizes all generation-stamped mark sets from the current node/proper-part spaces of the two trees. The tree topology is expected to keep these slot spaces stable under local releases performed by the adjuster.
Definition at line 1270 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inlinestaticconstexpr |
Returns the bit-width threshold for dense bucket selection.
Definition at line 1257 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inline |
Prunes max-tree subtrees and updates the min-tree before each prune.
Invalid, dead, and root nodes are ignored. For each valid max-tree root, the min-tree is updated first against the subtree that is about to be removed; then the max-tree subtree is pruned.
| nodesToPrune | Node identifiers selected for pruning. |
Definition at line 1325 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inline |
Prunes min-tree subtrees and updates the max-tree before each prune.
Invalid, dead, and root nodes are ignored. For each valid min-tree root, the max-tree is updated first against the subtree that is about to be removed; then the min-tree subtree is pruned.
| nodesToPrune | Node identifiers selected for pruning. |
Definition at line 1347 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inline |
Registers one shared incremental attribute computer for both trees.
| computer | Flag controlling computer. |
| bufferMin | Min-tree attribute buffer. |
| bufferMax | Max-tree attribute buffer. |
Definition at line 1312 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inline |
Registers incremental attribute computers and their external buffers.
The buffers are not owned by the adjuster. They must remain alive and indexed by internal NodeId while pruning/update calls are executed.
| computerMin | Flag controlling computer min. |
| computerMax | Flag controlling computer max. |
| bufferMin | Min-tree attribute buffer. |
| bufferMax | Max-tree attribute buffer. |
Definition at line 1297 of file DualMinMaxTreeIncrementalFilter.hpp.
|
inlinestaticconstexpr |
Reports whether this altitude type uses dense per-level buckets.
Definition at line 1250 of file DualMinMaxTreeIncrementalFilter.hpp.