8#include "../utils/Common.hpp"
9#include "../utils/RegularGridAdjacency2D.hpp"
23 UnrestrictedResidualTree,
80 std::variant<NoConstructionContext, SharedAdjacencyContext, SaturatedResidualContext, TopographicConvention>;
97 case MorphologicalTreeKind::MaxTree:
98 return NodeAltitudeOrder::Increasing;
99 case MorphologicalTreeKind::MinTree:
100 return NodeAltitudeOrder::Decreasing;
101 case MorphologicalTreeKind::Generic:
102 case MorphologicalTreeKind::TreeOfShapes:
103 case MorphologicalTreeKind::UnrestrictedResidualTree:
104 case MorphologicalTreeKind::SaturatedResidualTree:
105 return NodeAltitudeOrder::Unconstrained;
107 return NodeAltitudeOrder::Unconstrained;
114 return MorphologicalTreeSemantics{kind, defaultNodeAltitudeOrder(kind), std::move(constructionContext)};
127 throw std::invalid_argument(
"Morphological-tree kind and node-altitude order are incompatible.");
133 if (semantics.
kind == MorphologicalTreeKind::Generic || semantics.
kind == MorphologicalTreeKind::MaxTree ||
134 semantics.
kind == MorphologicalTreeKind::MinTree || semantics.
kind == MorphologicalTreeKind::UnrestrictedResidualTree) {
137 throw std::invalid_argument(
"SharedAdjacencyContext is incompatible with the declared morphological-tree kind.");
140 if (semantics.
kind == MorphologicalTreeKind::SaturatedResidualTree) {
143 throw std::invalid_argument(
"SaturatedResidualContext requires SaturatedResidualTree kind.");
146 if (semantics.
kind == MorphologicalTreeKind::TreeOfShapes) {
149 throw std::invalid_argument(
"TopographicConvention requires TreeOfShapes kind.");
151 throw std::invalid_argument(
"Unsupported morphological-tree construction context.");
std::variant< NoConstructionContext, SharedAdjacencyContext, SaturatedResidualContext, TopographicConvention > MorphologicalTreeConstructionContext
Tagged construction context retained by morphological-tree semantics.
MorphologicalTreeSemantics makeMorphologicalTreeSemantics(MorphologicalTreeKind kind, MorphologicalTreeConstructionContext constructionContext=NoConstructionContext{})
Constructs semantics using the conventional altitude order of kind.
NodeAltitudeOrder
Global ordering constraint of node altitudes along parent-child arcs.
@ Unconstrained
No global parent-child altitude order is declared.
@ Decreasing
Every alive parent-child arc satisfies nodeAltitude(parent) > nodeAltitude(child).
@ Increasing
Every alive parent-child arc satisfies nodeAltitude(parent) < nodeAltitude(child).
TopographicDomainExtension
Relation between the source pixel domain and active topographic domain.
std::variant< SelfDualSpanImmersion, ComplementaryGridImmersion > TreeOfShapesImmersion
Tagged tree-of-shapes immersion family.
MorphologicalTreeKind
Declared construction family of one morphological tree.
NodeAltitudeOrder defaultNodeAltitudeOrder(MorphologicalTreeKind kind) noexcept
Returns the conventional node-altitude order of a declared tree kind.
void validateMorphologicalTreeSemantics(const MorphologicalTreeSemantics &semantics)
Validates the scientific compatibility of a semantics descriptor.
Immutable regular-grid 2D adjacency with allocation-free traversal.
Ordered pair of complementary minimum and maximum adjacencies.
RegularGridAdjacency2D minAdjacency
Adjacency used for minimum-oriented processing.
RegularGridAdjacency2D maxAdjacency
Adjacency used for maximum-oriented processing.
Selects the optimized complementary-grid immersion.
ComplementaryAdjacencies complementaryAdjacencies
Ordered minimum/maximum adjacency pair.
Owning result for one computed scalar attribute layout and buffer.
Immutable scientific interpretation attached to one morphological tree.
NodeAltitudeOrder nodeAltitudeOrder
Global parent-child altitude order.
MorphologicalTreeConstructionContext constructionContext
Typed retained construction context.
MorphologicalTreeKind kind
Declared construction/result kind.
Explicitly records that no construction context is available.
Records the shared adjacency and infinity pixel of a saturated residual construction.
RegularGridAdjacency2D adjacency
Shared construction adjacency.
PixelId infinityPixel
Declared infinity pixel in the active domain.
Selects the self-dual span-valued tree-of-shapes immersion.
Records one adjacency shared by both construction polarities.
RegularGridAdjacency2D adjacency
Shared construction adjacency.
Complete discrete convention retained by a tree-of-shapes result.
TreeOfShapesImmersion immersion
Selected topographic immersion.
PixelId infinityPixel
Declared infinity pixel in the active topographic domain.
TopographicDomainExtension domainExtension
Active-domain extension convention.