mmcfilters
Public API documentation
Loading...
Searching...
No Matches
mmcfilters::adjust::CasfComponentTrees< T > Class Template Reference

Connected alternating sequential filter on paired component trees. More...

#include <CasfComponentTrees.hpp>

Public Member Functions

 CasfComponentTrees (image_ptr_t image, CasfComponentTreesAttribute attribute=CasfComponentTreesAttribute::Area, double radius=1.5)
 Initializes the CASF state from the input image and the chosen attribute.
image_ptr_t filter (const std::vector< double > &thresholds)
 Runs the CASF on the threshold sequence and returns the filtered image.
const tree_t & minTree () const noexcept
 Returns the current min-tree state.
const tree_t & maxTree () const noexcept
 Returns the current max-tree state.
CasfComponentTreesAttribute attribute () const noexcept
 Returns the increasing attribute configured for this CASF instance.
std::pair< std::vector< NodeId >, std::vector< T > > exportMinTree () const
 Exports the current min-tree as a compact static parent/altitude pair.
std::pair< std::vector< NodeId >, std::vector< T > > exportMaxTree () const
 Exports the current max-tree as a compact static parent/altitude pair.

Detailed Description

template<AltitudeValue T>
class mmcfilters::adjust::CasfComponentTrees< T >

Connected alternating sequential filter on paired component trees.

This class implements a connected alternating sequential filter (CASF) on a fixed image-domain adjacency. Instead of rebuilding both component trees after every threshold, it owns a mutable min-tree / max-tree pair and updates one tree incrementally whenever rooted subtrees are pruned from the dual one.

Supported workflow:

  • build the initial min-tree and max-tree from the same input image;
  • choose one increasing attribute used to select pruning candidates (AREA, BOUNDING_BOX_WIDTH, BOUNDING_BOX_HEIGHT, or BOUNDING_BOX_DIAGONAL);
  • run filter(thresholds) on one or more threshold sequences applied successively to the current state;
  • inspect or export the current dynamic tree state through minTree, maxTree, exportMinTree, and exportMaxTree.

For each threshold, the standard two CASF half-steps are performed:

  • select maximal max-tree nodes whose increasing attribute is below the threshold, update the min-tree incrementally, then prune those max-tree subtrees;
  • select maximal min-tree nodes under the same rule, update the max-tree incrementally, then prune those min-tree subtrees.

Internal state owned by this class:

  • the adjacency relation of the image domain;
  • the mutable valuedTree min-tree and max-tree;
  • one incremental attribute computer per tree and their output buffers;
  • the dual-tree adjustment helper used to propagate pruning from one tree to the other;
  • temporary buffers reused for breadth-first maximal candidate selection.

Update semantics:

  • calling filter(...) with a non-empty threshold sequence mutates the internal trees;
  • later filter(...) calls continue from the current filtered state;
  • an empty threshold sequence leaves the state unchanged and simply reconstructs the current image from the min-tree.

Attribute buffers are initialized once and then kept synchronized through DualMinMaxTreeIncrementalFilter; they are not globally recomputed at every threshold.

Ownership note:

CASF intentionally remains a mutable ValuedMorphologicalTree<T> owner. ValuedMorphologicalTreeView<T> is suited to read-only kernels; here each threshold step changes tree topology, smallest-node mapping, altitude state, and dynamic attribute buffers together.

Definition at line 79 of file CasfComponentTrees.hpp.

Constructor & Destructor Documentation

◆ CasfComponentTrees()

template<AltitudeValue T>
mmcfilters::adjust::CasfComponentTrees< T >::CasfComponentTrees ( image_ptr_t image,
CasfComponentTreesAttribute attribute = CasfComponentTreesAttribute::Area,
double radius = 1.5 )
inline

Initializes the CASF state from the input image and the chosen attribute.

Parameters
imageInput gray-level image.
attributeIncreasing attribute used to select pruning candidates.
radiusRadius used to build the image-domain adjacency relation.

Definition at line 207 of file CasfComponentTrees.hpp.

Member Function Documentation

◆ attribute()

template<AltitudeValue T>
CasfComponentTreesAttribute mmcfilters::adjust::CasfComponentTrees< T >::attribute ( ) const
inlinenodiscardnoexcept

Returns the increasing attribute configured for this CASF instance.

Returns
The increasing attribute configured for this CASF instance.

Definition at line 261 of file CasfComponentTrees.hpp.

◆ exportMaxTree()

template<AltitudeValue T>
std::pair< std::vector< NodeId >, std::vector< T > > mmcfilters::adjust::CasfComponentTrees< T >::exportMaxTree ( ) const
inlinenodiscard

Exports the current max-tree as a compact static parent/altitude pair.

The pair follows the local ValuedMorphologicalTree<T> export convention and can be compared with Higra-style static hierarchy outputs in tests and benchmarks.

Returns
The exported current max-tree as a compact static parent/altitude pair.

Definition at line 281 of file CasfComponentTrees.hpp.

◆ exportMinTree()

template<AltitudeValue T>
std::pair< std::vector< NodeId >, std::vector< T > > mmcfilters::adjust::CasfComponentTrees< T >::exportMinTree ( ) const
inlinenodiscard

Exports the current min-tree as a compact static parent/altitude pair.

The pair follows the local ValuedMorphologicalTree<T> export convention and can be compared with Higra-style static hierarchy outputs in tests and benchmarks.

Returns
The exported current min-tree as a compact static parent/altitude pair.

Definition at line 271 of file CasfComponentTrees.hpp.

◆ filter()

template<AltitudeValue T>
image_ptr_t mmcfilters::adjust::CasfComponentTrees< T >::filter ( const std::vector< double > & thresholds)
inlinenodiscard

Runs the CASF on the threshold sequence and returns the filtered image.

Thresholds are applied to the current internal state. The object is therefore stateful: successive non-empty calls continue filtering the result of the previous ones.

Parameters
thresholdsThresholds evaluated by the filter.
Returns
Image produced by the operation.

Definition at line 235 of file CasfComponentTrees.hpp.

◆ maxTree()

template<AltitudeValue T>
const tree_t & mmcfilters::adjust::CasfComponentTrees< T >::maxTree ( ) const
inlinenodiscardnoexcept

Returns the current max-tree state.

Returns
The current max-tree state.

Definition at line 254 of file CasfComponentTrees.hpp.

◆ minTree()

template<AltitudeValue T>
const tree_t & mmcfilters::adjust::CasfComponentTrees< T >::minTree ( ) const
inlinenodiscardnoexcept

Returns the current min-tree state.

Returns
The current min-tree state.

Definition at line 247 of file CasfComponentTrees.hpp.


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