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

Family of attribute-based image filtering operators on morphological trees. More...

#include <AttributeFilters.hpp>

Public Member Functions

 AttributeFilters (AltitudeView view)
 Creates filtering operators over a non-owning valued tree view.
 AttributeFilters (const ValuedMorphologicalTree< T > &valuedTree)
 Creates filtering operators over an owned valued tree.
 ~AttributeFilters ()=default
 Destroys the attribute-filter facade.
template<std::floating_point Real>
ImagePtr< T > filteringByPruningMin (const std::shared_ptr< Real[]> &attr, Real threshold)
 Applies pruning-min filtering from an attribute buffer.
template<std::floating_point Real>
ImagePtr< T > filteringByPruningMin (const Real *attr, Real threshold)
 Applies pruning-min filtering from a raw internal-node attribute buffer.
template<std::floating_point Real>
ImagePtr< T > filteringByPruningMax (const std::shared_ptr< Real[]> &attr, Real threshold)
 Applies pruning-max filtering from an attribute buffer.
template<std::floating_point Real>
ImagePtr< T > filteringByPruningMax (const Real *attr, Real threshold)
 Applies pruning-max filtering from a raw internal-node attribute buffer.
template<std::floating_point Real>
ImagePtr< T > filteringByViterbiRule (const Real *attr, Real threshold)
 Applies Salembier-style Viterbi filtering from a raw attribute buffer.
template<detail::NodePreservationDecisions Mask>
ImagePtr< T > filteringByPruningMin (const Mask &nodePreservationMask)
 Applies pruning-min filtering from a dense node-preservation mask.
template<detail::NodePreservationDecisions Mask>
ImagePtr< T > filteringByPruningMax (const Mask &nodePreservationMask)
 Applies pruning-max filtering from a dense node-preservation mask.

Static Public Member Functions

template<detail::NodePreservationDecisions Mask>
static void filteringByPruningMin (const ValuedMorphologicalTreeView< T > &valuedTree, const Mask &nodePreservationMask, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from a node-preservation mask into an output image.
template<detail::NodePreservationDecisions Mask>
static void filteringByPruningMin (const ValuedMorphologicalTree< T > &valuedTree, const Mask &nodePreservationMask, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from a valued-tree owner into an output image.
template<detail::NodePreservationDecisions Mask>
static void filteringByPruningMax (const ValuedMorphologicalTreeView< T > &valuedTree, const Mask &nodePreservationMask, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from a node-preservation mask into an output image.
template<detail::NodePreservationDecisions Mask>
static void filteringByPruningMax (const ValuedMorphologicalTree< T > &valuedTree, const Mask &nodePreservationMask, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from a valued-tree owner into an output image.
template<std::floating_point Real>
static void filteringByPruningMin (const ValuedMorphologicalTreeView< T > &valuedTree, const std::shared_ptr< Real[]> &attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from an owned attribute buffer into an output image.
template<std::floating_point Real>
static void filteringByPruningMin (const ValuedMorphologicalTree< T > &valuedTree, const std::shared_ptr< Real[]> &attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from a valued-tree owner and owned attribute buffer.
template<std::floating_point Real>
static void filteringByPruningMin (const ValuedMorphologicalTreeView< T > &valuedTree, const Real *attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from a raw attribute buffer into an output image.
template<std::floating_point Real>
static void filteringByPruningMin (const ValuedMorphologicalTree< T > &valuedTree, const Real *attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-min filtering from a valued-tree owner and raw attribute buffer.
template<std::floating_point Real>
static void filteringByPruningMax (const ValuedMorphologicalTreeView< T > &valuedTree, const std::shared_ptr< Real[]> &attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from an owned attribute buffer into an output image.
template<std::floating_point Real>
static void filteringByPruningMax (const ValuedMorphologicalTree< T > &valuedTree, const std::shared_ptr< Real[]> &attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from a valued-tree owner and owned attribute buffer.
template<std::floating_point Real>
static void filteringByPruningMax (const ValuedMorphologicalTreeView< T > &valuedTree, const Real *attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from a raw attribute buffer into an output image.
template<std::floating_point Real>
static void filteringByPruningMax (const ValuedMorphologicalTree< T > &valuedTree, const Real *attribute, Real threshold, ImagePtr< T > imgOutputPtr)
 Writes pruning-max filtering from a valued-tree owner and raw attribute buffer.

Detailed Description

template<AltitudeValue T>
class mmcfilters::AttributeFilters< T >

Family of attribute-based image filtering operators on morphological trees.

AttributeFilters groups pruning, Viterbi, and extinction-related operations. Direct and subtractive reconstruction are exposed separately by DirectAttributeFilter, SubtractiveAttributeFilter, and SoftSubtractiveAttributeFilter. The operators consume preservation masks or attribute buffers defined on dense node ids and reconstruct pixel images.

Contract and node-domain assumptions:

  • every preservation mask, score, and attribute buffer is indexed by the dense internal NodeId slot domain, not by exported Higra ids;
  • only alive nodes are reconstructed, but buffers must still cover every internal slot so callers can reuse the tree-wide attribute layout;
  • preservation masks contain exactly numInternalNodeSlots() entries; raw and shared attribute pointers must provide at least that many readable entries. Their length cannot be checked by these overloads;
  • output pixels are written through direct smallest-node mapping. A node represents the support of its full subtree, while properPart(node) contains only the pixels owned directly by that node;
  • propagation rules are evaluated in explicit root-to-leaf order because the dense NodeId slot order is not a topological order after Higra import or structural edits;
  • public object methods snapshot the topology mutation version at construction and reject use after the tree structure changes.

Reconstruction rule summary:

  • Viterbi rule: a dynamic program chooses a connected preserved set from threshold-derived preserve/remove costs, then reconstructs it with the direct rule;
  • pruning-min rule: rejected branches are cut immediately and their whole subtree is painted at the current accepted ancestor level;
  • pruning-max rule: only subtrees whose nodes are all rejected are cut, and such subtrees are painted at the rejected subtree root level.

Pruning-min accepts a node when its attribute is greater than or equal to the threshold; pruning-max marks a node as rejected when its attribute is less than the threshold. This is the same inclusive rule used by computeNodePreservationMask. Both rules always visit the root. Each visited node writes its own altitude to its proper part; a collapsed subtree receives the altitude selected by the rule above. Returned images own their storage and have the tree's grid dimensions. Overloads taking an output image require those same dimensions and write into the supplied storage.

Definition at line 70 of file AttributeFilters.hpp.

Constructor & Destructor Documentation

◆ AttributeFilters() [1/2]

template<AltitudeValue T>
mmcfilters::AttributeFilters< T >::AttributeFilters ( AltitudeView view)
inlineexplicit

Creates filtering operators over a non-owning valued tree view.

The view must remain valid for the lifetime of the filter object. Public methods reject use after the underlying topology mutates.

Parameters
viewTree view.

Definition at line 375 of file AttributeFilters.hpp.

◆ AttributeFilters() [2/2]

template<AltitudeValue T>
mmcfilters::AttributeFilters< T >::AttributeFilters ( const ValuedMorphologicalTree< T > & valuedTree)
inlineexplicit

Creates filtering operators over an owned valued tree.

This overload keeps a pointer to the owner so methods that require tree-owned altitude state, such as MSER-assisted preservation selection, can be used.

Parameters
valuedTreeValued tree.

Definition at line 388 of file AttributeFilters.hpp.

Member Function Documentation

◆ filteringByPruningMax() [1/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const Mask & nodePreservationMask)
inlinenodiscard

Applies pruning-max filtering from a dense node-preservation mask.

Parameters
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 497 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [2/9]

template<AltitudeValue T>
template<std::floating_point Real>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const Real * attr,
Real threshold )
inlinenodiscard

Applies pruning-max filtering from a raw internal-node attribute buffer.

Parameters
attrNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 448 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [3/9]

template<AltitudeValue T>
template<std::floating_point Real>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const std::shared_ptr< Real[]> & attr,
Real threshold )
inlinenodiscard

Applies pruning-max filtering from an attribute buffer.

Nodes with attribute values at or above threshold are kept, and fully rejected subtrees are reconstructed at their own subtree levels.

Parameters
attrNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 436 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [4/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTree< T > & valuedTree,
const Mask & nodePreservationMask,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from a valued-tree owner into an output image.

Parameters
valuedTreeValued tree.
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 554 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [5/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTree< T > & valuedTree,
const Real * attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from a valued-tree owner and raw attribute buffer.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 669 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [6/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTree< T > & valuedTree,
const std::shared_ptr< Real[]> & attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from a valued-tree owner and owned attribute buffer.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 640 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [7/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTreeView< T > & valuedTree,
const Mask & nodePreservationMask,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from a node-preservation mask into an output image.

Parameters
valuedTreeValued tree.
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 540 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [8/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTreeView< T > & valuedTree,
const Real * attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from a raw attribute buffer into an output image.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 655 of file AttributeFilters.hpp.

◆ filteringByPruningMax() [9/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMax ( const ValuedMorphologicalTreeView< T > & valuedTree,
const std::shared_ptr< Real[]> & attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-max filtering from an owned attribute buffer into an output image.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 626 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [1/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const Mask & nodePreservationMask)
inlinenodiscard

Applies pruning-min filtering from a dense node-preservation mask.

Parameters
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 483 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [2/9]

template<AltitudeValue T>
template<std::floating_point Real>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const Real * attr,
Real threshold )
inlinenodiscard

Applies pruning-min filtering from a raw internal-node attribute buffer.

Parameters
attrNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 419 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [3/9]

template<AltitudeValue T>
template<std::floating_point Real>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const std::shared_ptr< Real[]> & attr,
Real threshold )
inlinenodiscard

Applies pruning-min filtering from an attribute buffer.

Nodes with attribute values at or above threshold remain traversable; rejected subtrees are reconstructed at the ancestor level selected by the pruning-min rule.

Parameters
attrNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
Returns
Independently allocated image with the tree's grid dimensions.

Definition at line 407 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [4/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTree< T > & valuedTree,
const Mask & nodePreservationMask,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from a valued-tree owner into an output image.

Parameters
valuedTreeValued tree.
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 526 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [5/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTree< T > & valuedTree,
const Real * attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from a valued-tree owner and raw attribute buffer.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 612 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [6/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTree< T > & valuedTree,
const std::shared_ptr< Real[]> & attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from a valued-tree owner and owned attribute buffer.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 583 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [7/9]

template<AltitudeValue T>
template<detail::NodePreservationDecisions Mask>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTreeView< T > & valuedTree,
const Mask & nodePreservationMask,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from a node-preservation mask into an output image.

Parameters
valuedTreeValued tree.
nodePreservationMaskDecisions indexed by internal NodeId, with exactly numInternalNodeSlots() entries; true accepts a node.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 512 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [8/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTreeView< T > & valuedTree,
const Real * attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from a raw attribute buffer into an output image.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 598 of file AttributeFilters.hpp.

◆ filteringByPruningMin() [9/9]

template<AltitudeValue T>
template<std::floating_point Real>
void mmcfilters::AttributeFilters< T >::filteringByPruningMin ( const ValuedMorphologicalTreeView< T > & valuedTree,
const std::shared_ptr< Real[]> & attribute,
Real threshold,
ImagePtr< T > imgOutputPtr )
inlinestatic

Writes pruning-min filtering from an owned attribute buffer into an output image.

Parameters
valuedTreeValued tree.
attributeNon-null attribute buffer indexed by internal NodeId, with at least numInternalNodeSlots() readable entries.
thresholdPruning cutoff; values equal to it are preserved.
imgOutputPtrNon-null output image with the tree's grid dimensions.

Definition at line 569 of file AttributeFilters.hpp.

◆ filteringByViterbiRule()

template<AltitudeValue T>
template<std::floating_point Real>
ImagePtr< T > mmcfilters::AttributeFilters< T >::filteringByViterbiRule ( const Real * attr,
Real threshold )
inlinenodiscard

Applies Salembier-style Viterbi filtering from a raw attribute buffer.

The internal detail implementation turns attr and threshold into preserve/remove costs and solves the optimal connected keep mask on the tree. The root is always preserved. Once the Viterbi path removes a node, every descendant is removed as well; preserved descendants can only appear below preserved ancestors. The final image is reconstructed by the direct rule using that connected node-preservation mask.

Parameters
attrAttribute requested by the operation.
thresholdThreshold applied by the operation.
Returns
Image produced by the operation.

Definition at line 468 of file AttributeFilters.hpp.


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