MorphologicalAttributeFilters
Public API documentation
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
mmcfilters::HierarchySaliencyMapValidation Class Reference

Validates and transforms hierarchy valuations used by saliency maps. More...

#include <HierarchySaliencyMapValidation.hpp>

Static Public Member Functions

static void validateHierarchyConnectivity (const MorphologicalTree &tree, const RegularGridAdjacency2D &adjacency, const char *context="HierarchySaliencyMapValidation::validateHierarchyConnectivity")
 Validates that every hierarchy support is connected in adjacency.
 
template<class Value >
static void validateHierarchyValuation (const MorphologicalTree &tree, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyValuationRangePolicy rangePolicy=HierarchyValuationRangePolicy::AllowAnyFinite, const char *context="HierarchySaliencyMapValidation::validateHierarchyValuation")
 Validates that a node-indexed valuation is compatible with a hierarchy.
 
template<class Value >
static std::vector< intrankHierarchyValuation (const MorphologicalTree &tree, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse)
 Converts a compatible valuation to dense non-negative integer levels.
 
template<class Value >
static std::vector< doublecomputeNormalizedScores (const MorphologicalTree &tree, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyValuationRangePolicy rangePolicy=HierarchyValuationRangePolicy::AllowAnyFinite)
 Normalizes a compatible hierarchy valuation to [0, 1].
 
template<AltitudeValue T>
static std::vector< doublecomputeNormalizedScores (const ValuedMorphologicalTree< T > &tree)
 Computes a dense normalized altitude score buffer in [0, 1].
 

Detailed Description

Validates and transforms hierarchy valuations used by saliency maps.

A hierarchy valuation assigns one scalar level to each internal tree node. It is compatible with the quasi-flat-zone saliency definition when it is non-decreasing along the ancestry order:

valuation(parent) >= valuation(child)

This class centralizes checks and monotone reparameterizations of that valuation. It does not project the hierarchy onto graph edges; use HierarchySaliencyMap for the formal edge-indexed saliency map.

Definition at line 150 of file HierarchySaliencyMapValidation.hpp.

Member Function Documentation

◆ computeNormalizedScores() [1/2]

template<class Value >
static std::vector< double > mmcfilters::HierarchySaliencyMapValidation::computeNormalizedScores ( const MorphologicalTree tree,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyValuationRangePolicy  rangePolicy = HierarchyValuationRangePolicy::AllowAnyFinite 
)
inlinestatic

Normalizes a compatible hierarchy valuation to [0, 1].

The input valuation is validated first, so it must be finite for floating-point types and monotone along the hierarchy according to policy. The returned double buffer preserves the input order with an increasing affine transform over live-node values:

normalized(node) = (valuation(node) - minLiveValue) / range

Equal-valued adjacent levels therefore remain collapsed. If every live node has the same valuation, all normalized values are zero. The computation avoids forming an overflowing maxLiveValue - minLiveValue when finite floating-point extrema span both signs, and clamps round-off at the output boundaries so every returned live-node score remains in [0, 1].

Parameters
treeTree topology.
valuationNode valuation.
policyPolicy controlling the operation.
rangePolicyPolicy for values outside the supported range.
Returns
Values produced by the operation.

Definition at line 418 of file HierarchySaliencyMapValidation.hpp.

◆ computeNormalizedScores() [2/2]

template<AltitudeValue T>
static std::vector< double > mmcfilters::HierarchySaliencyMapValidation::computeNormalizedScores ( const ValuedMorphologicalTree< T > &  tree)
inlinestatic

Computes a dense normalized altitude score buffer in [0, 1].

The altitude is first converted to a hierarchy-compatible valuation: max-tree altitudes are inverted, while min-tree altitudes keep their natural coarse-to-fine order. The generic computeNormalizedScores helper then normalizes that valuation. Trees without a single component-tree polarity are rejected.

Parameters
treeTree topology.
Returns
The computed dense normalized altitude score buffer in [0, 1].

Definition at line 487 of file HierarchySaliencyMapValidation.hpp.

◆ rankHierarchyValuation()

template<class Value >
static std::vector< int > mmcfilters::HierarchySaliencyMapValidation::rankHierarchyValuation ( const MorphologicalTree tree,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse 
)
inlinestatic

Converts a compatible valuation to dense non-negative integer levels.

Cousty et al. state saliency maps on an integer level range. This helper keeps the caller's hierarchy scale order but re-encodes the distinct live-node valuation values as dense ranks 0..k-1. Equal valuation values receive the same rank, so level collapse is preserved. The input is validated before ranking; floating-point values must be finite and the selected hierarchy monotonicity policy is enforced.

Parameters
treeTree topology.
valuationNode valuation.
policyPolicy controlling the operation.
Returns
The converted compatible valuation to dense non-negative integer levels.

Definition at line 371 of file HierarchySaliencyMapValidation.hpp.

◆ validateHierarchyConnectivity()

static void mmcfilters::HierarchySaliencyMapValidation::validateHierarchyConnectivity ( const MorphologicalTree tree,
const RegularGridAdjacency2D adjacency,
const char context = "HierarchySaliencyMapValidation::validateHierarchyConnectivity" 
)
inlinestatic

Validates that every hierarchy support is connected in adjacency.

Each image-domain edge is assigned to the LCA of its endpoint smallest nodes. Nodes are then processed in post-order. At a node, all edges assigned to it are inserted into one disjoint-set forest; the node is connected if its direct proper parts and already-connected child supports have one common representative. This simultaneously validates the completed hierarchy in which every direct proper-part region is a finest graph region.

Parameters
treeHierarchy topology and smallest-node mapping.
adjacencyGraph defining connectedness.
contextOperation name used in diagnostics.
Exceptions
std::invalid_argumentIf the graph domain differs from the tree or any live-node support is disconnected.

Definition at line 193 of file HierarchySaliencyMapValidation.hpp.

◆ validateHierarchyValuation()

template<class Value >
static void mmcfilters::HierarchySaliencyMapValidation::validateHierarchyValuation ( const MorphologicalTree tree,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyValuationRangePolicy  rangePolicy = HierarchyValuationRangePolicy::AllowAnyFinite,
const char context = "HierarchySaliencyMapValidation::validateHierarchyValuation" 
)
inlinestatic

Validates that a node-indexed valuation is compatible with a hierarchy.

This is the contract required by the saliency map definition based on quasi-flat zones. The valuation supplies the hierarchy scale; the tree supplies the nested regions. A compatible valuation is defined for every dense internal NodeId slot and is monotone along every live parent-child relation. Floating-point valuations must also be finite.

AllowLevelCollapse accepts valuation(parent) >= valuation(child). The resulting edge map is a formal saliency map for the hierarchy after merging any adjacent levels with equal valuation. RequireStrictHierarchy requires valuation(parent) > valuation(child) and should be used when the edge map must recover every explicit level of the current tree.

Parameters
treeTree topology.
valuationNode valuation.
policyPolicy controlling the operation.
rangePolicyPolicy for values outside the supported range.
contextOperation context or diagnostic label.

Definition at line 322 of file HierarchySaliencyMapValidation.hpp.


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