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

Projects a morphological tree hierarchy onto an image adjacency graph. More...

#include <HierarchySaliencyMap.hpp>

Static Public Member Functions

static RegularGridAdjacency2D requireProjectionAdjacency (const MorphologicalTree &tree, const char *context="HierarchySaliencyMap::requireProjectionAdjacency")
 Returns the unambiguous adjacency stored by a hierarchy.
 
static std::vector< intcomputeTopologicalLevels (const MorphologicalTree &tree)
 Computes a dense topological level buffer indexed by internal NodeId.
 
static std::vector< intcomputePartitionAppearanceLevels (const MorphologicalTree &tree)
 Computes partition-appearance indexes for the proper-part completion.
 
template<class NodeValue >
static auto computeEdgeMap (const MorphologicalTree &tree, const RegularGridAdjacency2D &adjacency, NodeValue &&nodeValue) -> EdgeSaliencyMap< std::decay_t< std::invoke_result_t< NodeValue, NodeId > > >
 Computes an edge saliency map using an explicit adjacency relation.
 
template<class Value >
static EdgeSaliencyMap< ValuecomputeSaliencyEdgeMap (const MorphologicalTree &tree, const RegularGridAdjacency2D &adjacency, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyLevelConvention levelConvention=HierarchyLevelConvention::EdgeSaliencyValue, HierarchyConnectivityPolicy connectivityPolicy=HierarchyConnectivityPolicy::ValidateConnected)
 Computes the formal edge-indexed saliency map induced by a valuation.
 
template<class Value >
static EdgeSaliencyMap< ValuecomputeSaliencyEdgeMap (const MorphologicalTree &tree, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyLevelConvention levelConvention=HierarchyLevelConvention::EdgeSaliencyValue, HierarchyConnectivityPolicy connectivityPolicy=HierarchyConnectivityPolicy::ValidateConnected)
 Computes a formal saliency map using one unambiguous stored graph.
 
template<class Value >
static EdgeSaliencyMap< intcomputeCanonicalRankedSaliencyEdgeMap (const MorphologicalTree &tree, const RegularGridAdjacency2D &adjacency, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyConnectivityPolicy connectivityPolicy=HierarchyConnectivityPolicy::ValidateConnected)
 Computes the canonical dense integer saliency scale of a valuation.
 
template<class Value >
static EdgeSaliencyMap< intcomputeCanonicalRankedSaliencyEdgeMap (const MorphologicalTree &tree, std::span< const Value > valuation, HierarchyValuationPolicy policy=HierarchyValuationPolicy::AllowLevelCollapse, HierarchyConnectivityPolicy connectivityPolicy=HierarchyConnectivityPolicy::ValidateConnected)
 Stored-adjacency overload of computeCanonicalRankedSaliencyEdgeMap.
 
template<class Value >
static EdgeSaliencyMap< intrankEdgeSaliencyMap (const EdgeSaliencyMap< Value > &edgeMap)
 Densely ranks the values already present in an edge saliency map.
 
template<class NodeValue >
static auto computeEdgeMap (const MorphologicalTree &tree, NodeValue &&nodeValue) -> EdgeSaliencyMap< std::decay_t< std::invoke_result_t< NodeValue, NodeId > > >
 Computes an edge saliency map using one unambiguous stored graph.
 
static EdgeSaliencyMap< intcomputeTopologicalLevelEdgeMap (const MorphologicalTree &tree, const RegularGridAdjacency2D &adjacency)
 Computes a topological-level edge saliency map with explicit adjacency.
 
static EdgeSaliencyMap< intcomputeTopologicalLevelEdgeMap (const MorphologicalTree &tree)
 Computes a topological-level map using one unambiguous stored graph.
 
template<AltitudeValue T>
static EdgeSaliencyMap< doublecomputeNormalizedAltitudeEdgeMap (const ValuedMorphologicalTree< T > &tree, const RegularGridAdjacency2D &adjacency)
 Computes a normalized-altitude edge saliency map with explicit adjacency.
 
template<AltitudeValue T>
static EdgeSaliencyMap< doublecomputeNormalizedAltitudeEdgeMap (const ValuedMorphologicalTree< T > &tree)
 Computes a normalized-altitude map using one unambiguous stored graph.
 

Detailed Description

Projects a morphological tree hierarchy onto an image adjacency graph.

The generic computeEdgeMap primitive finds the inclusion-smallest nodes of each graph edge endpoint, takes their lowest common ancestor in the hierarchy, and writes nodeValue(lca) as the edge value. The formal computeSaliencyEdgeMap path additionally assigns the base value 0 to edges whose endpoints already belong to the same finest region represented by the tree. With a connected complete hierarchy and a compatible valuation, this is the Phi(H) saliency-map representation from Cousty et al., "Hierarchical segmentations with graphs: quasi-flat zones, minimum spanning trees, and saliency maps". This class implements that edge-indexed hierarchy projection only; it does not build the full Psi(w) = Phi(QFZ(G, w)) pipeline from an arbitrary edge-valuedTree graph, nor the paper's MST characterization.

Primary reference
Jean Cousty, Laurent Najman, Yukiko Kenmochi, and Silvio GuimarĂ£es, "Hierarchical segmentations with graphs: quasi-flat zones, minimum spanning trees, and saliency maps," Journal of Mathematical Imaging and Vision, 60(4):479-502, 2018. DOI 10.1007/s10851-017-0768-7. The direct projection corresponds to Section 4, Equations (5)-(6), and Section 7, Algorithm 1.

Definition at line 101 of file HierarchySaliencyMap.hpp.

Member Function Documentation

◆ computeCanonicalRankedSaliencyEdgeMap() [1/2]

template<class Value >
static EdgeSaliencyMap< int > mmcfilters::HierarchySaliencyMap::computeCanonicalRankedSaliencyEdgeMap ( const MorphologicalTree tree,
const RegularGridAdjacency2D adjacency,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyConnectivityPolicy  connectivityPolicy = HierarchyConnectivityPolicy::ValidateConnected 
)
inlinestatic

Computes the canonical dense integer saliency scale of a valuation.

Unlike rankHierarchyValuation, this operation ranks only values that actually occur as transition levels on graph edges. Same-smallest-node edges form the base level when present. This removes unused node ranks and produces the minimal dense scale associated with the completed graph hierarchy. Input values may be negative because only their order is retained.

Parameters
treeHierarchy topology and smallest-node mapping.
adjacencyProjection graph.
valuationFinite hierarchy-compatible node valuation.
policyWhether adjacent equal hierarchy values may collapse.
connectivityPolicyWhether to verify graph connectedness.
Returns
Edge saliency map with dense values 0..k-1 over effective edges.

Definition at line 436 of file HierarchySaliencyMap.hpp.

◆ computeCanonicalRankedSaliencyEdgeMap() [2/2]

template<class Value >
static EdgeSaliencyMap< int > mmcfilters::HierarchySaliencyMap::computeCanonicalRankedSaliencyEdgeMap ( const MorphologicalTree tree,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyConnectivityPolicy  connectivityPolicy = HierarchyConnectivityPolicy::ValidateConnected 
)
inlinestatic

Stored-adjacency overload of computeCanonicalRankedSaliencyEdgeMap.

Template Parameters
ValueNode-valuation scalar type.
Parameters
treeTree topology carrying one unambiguous stored projection graph.
valuationDense valuation indexed by internal node id.
policyWhether equal parent/child hierarchy values are accepted.
connectivityPolicyWhether spatial support connectivity is validated.
Returns
Full edge map with dense ranks over effective transition values.

Definition at line 511 of file HierarchySaliencyMap.hpp.

◆ computeEdgeMap() [1/2]

template<class NodeValue >
static auto mmcfilters::HierarchySaliencyMap::computeEdgeMap ( const MorphologicalTree tree,
const RegularGridAdjacency2D adjacency,
NodeValue &&  nodeValue 
) -> EdgeSaliencyMap<std::decay_t<std::invoke_result_t<NodeValue, NodeId>>>
inlinestatic

Computes an edge saliency map using an explicit adjacency relation.

NodeValue must be callable as nodeValue(NodeId) and is invoked once per graph edge on the LCA of the two endpoint smallest nodes. This is the generic LCA projection primitive; use computeSaliencyEdgeMap when arbitrary node values must be validated as a formal hierarchy valuation before projection.

Parameters
treeTree topology.
adjacencyAdjacency relation.
nodeValueValue assigned to the node.
Returns
The computed edge saliency map using an explicit adjacency relation.

Definition at line 248 of file HierarchySaliencyMap.hpp.

◆ computeEdgeMap() [2/2]

template<class NodeValue >
static auto mmcfilters::HierarchySaliencyMap::computeEdgeMap ( const MorphologicalTree tree,
NodeValue &&  nodeValue 
) -> EdgeSaliencyMap<std::decay_t<std::invoke_result_t<NodeValue, NodeId>>>
inlinestatic

Computes an edge saliency map using one unambiguous stored graph.

Parameters
treeTree topology.
nodeValueValue assigned to the node.
Returns
The computed edge saliency map using one unambiguous stored graph.

Definition at line 551 of file HierarchySaliencyMap.hpp.

◆ computeNormalizedAltitudeEdgeMap() [1/2]

template<AltitudeValue T>
static EdgeSaliencyMap< double > mmcfilters::HierarchySaliencyMap::computeNormalizedAltitudeEdgeMap ( const ValuedMorphologicalTree< T > &  tree)
inlinestatic

Computes a normalized-altitude map using one unambiguous stored graph.

Parameters
treeTree topology.
Returns
The computed normalized-altitude map using one unambiguous stored graph.

Definition at line 598 of file HierarchySaliencyMap.hpp.

◆ computeNormalizedAltitudeEdgeMap() [2/2]

template<AltitudeValue T>
static EdgeSaliencyMap< double > mmcfilters::HierarchySaliencyMap::computeNormalizedAltitudeEdgeMap ( const ValuedMorphologicalTree< T > &  tree,
const RegularGridAdjacency2D adjacency 
)
inlinestatic

Computes a normalized-altitude edge saliency map with explicit adjacency.

Parameters
treeTree topology.
adjacencyAdjacency relation.
Returns
The computed normalized-altitude edge saliency map with explicit adjacency.

Definition at line 586 of file HierarchySaliencyMap.hpp.

◆ computePartitionAppearanceLevels()

static std::vector< int > mmcfilters::HierarchySaliencyMap::computePartitionAppearanceLevels ( const MorphologicalTree tree)
inlinestatic

Computes partition-appearance indexes for the proper-part completion.

Direct proper-part regions form the first non-singleton partition level. Consequently, these indexes are the structural saliency heights shifted by one: internal leaves receive 1, and every ancestor receives one plus the maximum child appearance level.

Parameters
treeTree topology.
Returns
Dense positive integer levels indexed by internal NodeId.

Definition at line 226 of file HierarchySaliencyMap.hpp.

◆ computeSaliencyEdgeMap() [1/2]

template<class Value >
static EdgeSaliencyMap< Value > mmcfilters::HierarchySaliencyMap::computeSaliencyEdgeMap ( const MorphologicalTree tree,
const RegularGridAdjacency2D adjacency,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyLevelConvention  levelConvention = HierarchyLevelConvention::EdgeSaliencyValue,
HierarchyConnectivityPolicy  connectivityPolicy = HierarchyConnectivityPolicy::ValidateConnected 
)
inlinestatic

Computes the formal edge-indexed saliency map induced by a valuation.

This is the API that matches the saliency map Phi(H) defined in Cousty et al., "Hierarchical segmentations with graphs: quasi-flat zones, minimum spanning trees, and saliency maps": the result is a function on graph edges, not a raster contour image. The input valuation is validated before projection so arbitrary node valuations cannot be mislabeled as a quasi-flat-zone saliency map. The caller provides H through the tree topology; this method does not construct QFZ(G, w) from an arbitrary edge-valuedTree graph.

Formal saliency valuations must be non-negative because edges internal to the finest represented regions use the fixed base level 0. Use HierarchySaliencyMapValidation::rankHierarchyValuation or computeNormalizedScores before projection when the original compatible valuation contains negative values.

For every adjacency edge (p, q), the returned value is the base level 0 when both endpoints already belong to the same finest region exposed by the tree. Otherwise, under EdgeSaliencyValue the returned value is:

valuation(LCA(smallestNode(p), smallestNode(q)))

Under PartitionAppearanceLevel, the returned transition value is instead valuation(LCA(...)) - 1, following Algorithm 1 of Cousty et al. In that convention, live-node values must be positive integer partition indexes. Here smallestNode maps a pixel to its inclusion-smallest hierarchy node. This keeps the saliency map defined on the full graph edge set while respecting the paper's cut-based definition: edges internal to a finest region are not contour transitions at any positive hierarchy level.

Parameters
treeTree topology.
adjacencyAdjacency relation.
valuationNode valuation.
policyPolicy controlling the operation.
levelConventionInterpretation of live-node valuation levels.
connectivityPolicyWhether to validate connected hierarchy supports.
Returns
The computed formal edge-indexed saliency map induced by a valuation.

Definition at line 331 of file HierarchySaliencyMap.hpp.

◆ computeSaliencyEdgeMap() [2/2]

template<class Value >
static EdgeSaliencyMap< Value > mmcfilters::HierarchySaliencyMap::computeSaliencyEdgeMap ( const MorphologicalTree tree,
std::span< const Value valuation,
HierarchyValuationPolicy  policy = HierarchyValuationPolicy::AllowLevelCollapse,
HierarchyLevelConvention  levelConvention = HierarchyLevelConvention::EdgeSaliencyValue,
HierarchyConnectivityPolicy  connectivityPolicy = HierarchyConnectivityPolicy::ValidateConnected 
)
inlinestatic

Computes a formal saliency map using one unambiguous stored graph.

Uniform adjacency is used directly. A directional context is accepted only when its decreasing and increasing relations have the same stencil; otherwise the caller must select an explicit projection graph.

Parameters
treeTree topology.
valuationNode valuation.
policyPolicy controlling the operation.
levelConventionInterpretation of live-node valuation levels.
connectivityPolicyWhether to validate connected hierarchy supports.
Returns
The computed formal saliency map using one unambiguous stored graph.

Definition at line 410 of file HierarchySaliencyMap.hpp.

◆ computeTopologicalLevelEdgeMap() [1/2]

static EdgeSaliencyMap< int > mmcfilters::HierarchySaliencyMap::computeTopologicalLevelEdgeMap ( const MorphologicalTree tree)
inlinestatic

Computes a topological-level map using one unambiguous stored graph.

Parameters
treeTree topology.
Returns
The computed topological-level map using one unambiguous stored graph.

Definition at line 574 of file HierarchySaliencyMap.hpp.

◆ computeTopologicalLevelEdgeMap() [2/2]

static EdgeSaliencyMap< int > mmcfilters::HierarchySaliencyMap::computeTopologicalLevelEdgeMap ( const MorphologicalTree tree,
const RegularGridAdjacency2D adjacency 
)
inlinestatic

Computes a topological-level edge saliency map with explicit adjacency.

Parameters
treeTree topology.
adjacencyAdjacency relation.
Returns
The computed topological-level edge saliency map with explicit adjacency.

Definition at line 563 of file HierarchySaliencyMap.hpp.

◆ computeTopologicalLevels()

static std::vector< int > mmcfilters::HierarchySaliencyMap::computeTopologicalLevels ( const MorphologicalTree tree)
inlinestatic

Computes a dense topological level buffer indexed by internal NodeId.

Leaf internal nodes receive level 0. Each other node receives one plus the maximum level of its direct children. The root therefore has the largest value in a connected tree, yielding a hierarchy scale that grows from fine regions toward coarse regions independently of altitude polarity.

Parameters
treeTree topology.
Returns
The computed dense topological level buffer indexed by internal NodeId.

Definition at line 201 of file HierarchySaliencyMap.hpp.

◆ rankEdgeSaliencyMap()

template<class Value >
static EdgeSaliencyMap< int > mmcfilters::HierarchySaliencyMap::rankEdgeSaliencyMap ( const EdgeSaliencyMap< Value > &  edgeMap)
inlinestatic

Densely ranks the values already present in an edge saliency map.

Template Parameters
ValueEdge-value scalar type.
Parameters
edgeMapEdge map whose distinct values define the rank scale.
Returns
Copy of the edge domain with values replaced by zero-based dense ranks in ascending value order.

Definition at line 526 of file HierarchySaliencyMap.hpp.

◆ requireProjectionAdjacency()

static RegularGridAdjacency2D mmcfilters::HierarchySaliencyMap::requireProjectionAdjacency ( const MorphologicalTree tree,
const char context = "HierarchySaliencyMap::requireProjectionAdjacency" 
)
inlinestatic

Returns the unambiguous adjacency stored by a hierarchy.

This public query lets higher-level saliency constructions reuse exactly the same graph-selection contract as the direct LCA projection.

Parameters
treeTree carrying adjacency semantics.
contextOperation name used in diagnostics.
Returns
Stored uniform graph, or the common graph of an equivalent directional pair.

Definition at line 184 of file HierarchySaliencyMap.hpp.


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