MorphologicalAttributeFilters
Public API documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t > Class Template Reference

Incremental updater for a paired min-tree / max-tree state. More...

#include <DualMinMaxTreeIncrementalFilter.hpp>

Public Member Functions

 DualMinMaxTreeIncrementalFilter (tree_t *mintree, tree_t *maxtree, AdjacencyRelation &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.
 

Detailed Description

template<AltitudeValue altitude_t>
class mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >

Incremental updater for a paired min-tree / max-tree state.

This class ports the Higra dual component-tree adjustment algorithm to this repository's WeightedMorphologicalTree<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:

Public usage model:

State managed by this class:

Ownership and lifetime:

Representation notes:

Internal notation follows the original adjustment routine:

Backend selection for mergeNodesByLevel:

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 105 of file DualMinMaxTreeIncrementalFilter.hpp.

Constructor & Destructor Documentation

◆ DualMinMaxTreeIncrementalFilter()

template<AltitudeValue altitude_t>
mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::DualMinMaxTreeIncrementalFilter ( tree_t mintree,
tree_t maxtree,
AdjacencyRelation graph 
)
inline

Creates an adjuster for externally owned min/max-tree states.

Parameters
mintreeMutable min-tree state.
maxtreeMutable max-tree state.
graphShared 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 1142 of file DualMinMaxTreeIncrementalFilter.hpp.

Member Function Documentation

◆ denseLevelBackendMaxBits()

template<AltitudeValue altitude_t>
static constexpr int mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::denseLevelBackendMaxBits ( )
inlinestaticconstexpr

Returns the bit-width threshold for dense bucket selection.

Definition at line 1127 of file DualMinMaxTreeIncrementalFilter.hpp.

◆ pruneMaxTreeAndUpdateMinTree()

template<AltitudeValue altitude_t>
void mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::pruneMaxTreeAndUpdateMinTree ( const std::vector< NodeId > &  nodesToPrune)
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.

Definition at line 1193 of file DualMinMaxTreeIncrementalFilter.hpp.

◆ pruneMinTreeAndUpdateMaxTree()

template<AltitudeValue altitude_t>
void mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::pruneMinTreeAndUpdateMaxTree ( const std::vector< NodeId > &  nodesToPrune)
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.

Definition at line 1215 of file DualMinMaxTreeIncrementalFilter.hpp.

◆ setAttributeComputer() [1/2]

template<AltitudeValue altitude_t>
void mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::setAttributeComputer ( const attribute_computer_t computer,
std::vector< double > &  bufferMin,
std::vector< double > &  bufferMax 
)
inline

Registers one shared incremental attribute computer for both trees.

Definition at line 1180 of file DualMinMaxTreeIncrementalFilter.hpp.

◆ setAttributeComputer() [2/2]

template<AltitudeValue altitude_t>
void mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::setAttributeComputer ( const attribute_computer_t computerMin,
const attribute_computer_t computerMax,
std::vector< double > &  bufferMin,
std::vector< double > &  bufferMax 
)
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.

Definition at line 1167 of file DualMinMaxTreeIncrementalFilter.hpp.

◆ usesDenseLevelBackend()

template<AltitudeValue altitude_t>
static constexpr bool mmcfilters::adjust::DualMinMaxTreeIncrementalFilter< altitude_t >::usesDenseLevelBackend ( )
inlinestaticconstexpr

Reports whether this altitude type uses dense per-level buckets.

Definition at line 1122 of file DualMinMaxTreeIncrementalFilter.hpp.


The documentation for this class was generated from the following file: