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

Pure operations over a topology and an explicit altitude buffer. More...

#include <TreeAltitudeAlgorithms.hpp>

Static Public Member Functions

static const char * nodeAltitudeOrderName (NodeAltitudeOrder order) noexcept
 Returns the name of a declared node-altitude order.
 
static bool hasGlobalMonotoneAltitudeOrder (const MorphologicalTree &tree) noexcept
 Tests whether the topology declares a globally monotone altitude order.
 
static void requireGlobalMonotoneAltitudeOrder (const MorphologicalTree &tree, const char *context)
 Requires a declared globally monotone altitude order.
 
template<AltitudeValue T>
static void validateNodeAltitudeBufferShape (const MorphologicalTree &tree, std::span< const T > altitude)
 Validates that an altitude buffer covers the dense internal-node domain.
 
template<AltitudeValue T>
static void validateFiniteAltitudeValue (T altitude, std::size_t index, const char *context)
 Rejects non-finite floating-point altitudes while compiling to a no-op for integral types.
 
template<AltitudeValue T>
static void validateFiniteAltitudeValues (std::span< const T > altitude, const char *context)
 Rejects non-finite floating-point altitudes in a contiguous input range.
 
template<AltitudeValue T>
static void validateFiniteImageAltitudes (const ImagePtr< T > &image, const char *context)
 Rejects non-finite floating-point pixels before using an image as altitude source.
 
template<AltitudeValue T>
static T nodeAltitude (std::span< const T > altitude, NodeId nodeId)
 Reads one node altitude from an explicit altitude buffer.
 
template<AltitudeValue T>
static AltitudeDifference< T > nodeResidue (const MorphologicalTree &tree, std::span< const T > altitude, NodeId nodeId)
 Computes the altitude difference between one node and its parent.
 
template<AltitudeValue T>
static std::uint8_t requireUInt8AltitudeValue (T altitude, NodeId nodeId, const char *context)
 Converts one altitude value to uint8_t, rejecting values outside the output domain.
 
template<AltitudeValue T>
static void validateUInt8AltitudeDomain (const MorphologicalTree &tree, std::span< const T > altitude, const char *context)
 Validates all live node altitudes before materialising an ImageUInt8.
 
template<AltitudeValue T>
static ImagePtr< T > reconstructFromNodeAltitudes (const MorphologicalTree &tree, std::span< const T > altitude, const char *context="TreeAltitudeAlgorithms::reconstructFromNodeAltitudes")
 Reconstructs a typed image from topology storage and explicit node altitudes.
 
template<class Contribution >
requires (std::is_arithmetic_v<Contribution> && !std::is_same_v<std::remove_cv_t<Contribution>, bool>)
static ImagePtr< Contribution > reconstructFromNodeContributions (const MorphologicalTree &tree, std::span< const Contribution > nodeContributions, const char *context="TreeAltitudeAlgorithms::reconstructFromNodeContributions")
 Reconstructs an image by summing node contributions on every root-to-node branch.
 
template<AltitudeValue T>
static std::pair< std::vector< NodeId >, std::vector< T > > exportHigraHierarchy (const MorphologicalTree &tree, std::span< const T > altitude)
 Exports a live rooted topology and explicit altitudes to a compact parent/altitude representation.
 
template<AltitudeValue T>
static void validateMonotoneNodeAltitudes (const MorphologicalTree &tree, std::span< const T > altitude)
 Validates the hierarchy's declared global altitude order.
 

Detailed Description

Pure operations over a topology and an explicit altitude buffer.

TreeAltitudeAlgorithms intentionally owns no state. It is the neutral home for algorithms that need only MorphologicalTree + std::span<const T>, leaving ValuedMorphologicalTree<std::uint8_t> as an owner/adaptor for canonical mutable state.

Definition at line 86 of file TreeAltitudeAlgorithms.hpp.

Member Function Documentation

◆ exportHigraHierarchy()

template<AltitudeValue T>
static std::pair< std::vector< NodeId >, std::vector< T > > mmcfilters::TreeAltitudeAlgorithms::exportHigraHierarchy ( const MorphologicalTree &  tree,
std::span< const T >  altitude 
)
inlinestatic

Exports a live rooted topology and explicit altitudes to a compact parent/altitude representation.

This method owns only the structural valuedTree export. It reuses detail::computeExportedHigraLayout() so the parent/altitude export has the same compact id convention used by attribute-buffer projection in AttributeComputation.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.
Returns
The exported live rooted topology and explicit altitudes to a compact parent/altitude representation.

Definition at line 327 of file TreeAltitudeAlgorithms.hpp.

◆ hasGlobalMonotoneAltitudeOrder()

static bool mmcfilters::TreeAltitudeAlgorithms::hasGlobalMonotoneAltitudeOrder ( const MorphologicalTree &  tree)
inlinestaticnoexcept

Tests whether the topology declares a globally monotone altitude order.

Parameters
treeTree topology.
Returns
True for Increasing or Decreasing, and false for Unconstrained.

Definition at line 112 of file TreeAltitudeAlgorithms.hpp.

◆ nodeAltitude()

template<AltitudeValue T>
static T mmcfilters::TreeAltitudeAlgorithms::nodeAltitude ( std::span< const T >  altitude,
NodeId  nodeId 
)
inlinestatic

Reads one node altitude from an explicit altitude buffer.

Parameters
altitudeAltitude data indexed by node identifier.
nodeIdDense internal node identifier.
Returns
The requested node altitude from an explicit altitude buffer.

Definition at line 195 of file TreeAltitudeAlgorithms.hpp.

◆ nodeAltitudeOrderName()

static const char * mmcfilters::TreeAltitudeAlgorithms::nodeAltitudeOrderName ( NodeAltitudeOrder  order)
inlinestaticnoexcept

Returns the name of a declared node-altitude order.

Parameters
orderRequested hierarchy ordering convention.
Returns
Order name.

Definition at line 94 of file TreeAltitudeAlgorithms.hpp.

◆ nodeResidue()

template<AltitudeValue T>
static AltitudeDifference< T > mmcfilters::TreeAltitudeAlgorithms::nodeResidue ( const MorphologicalTree &  tree,
std::span< const T >  altitude,
NodeId  nodeId 
)
inlinestatic

Computes the altitude difference between one node and its parent.

The reconstruction baseline is fixed at zero throughout the project. Consequently, a root-like node whose parent is invalid or itself has residue equal to its own altitude.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.
nodeIdDense internal node identifier.
Returns
The computed altitude difference between one node and its parent.

Definition at line 213 of file TreeAltitudeAlgorithms.hpp.

◆ reconstructFromNodeAltitudes()

template<AltitudeValue T>
static ImagePtr< T > mmcfilters::TreeAltitudeAlgorithms::reconstructFromNodeAltitudes ( const MorphologicalTree &  tree,
std::span< const T >  altitude,
const char *  context = "TreeAltitudeAlgorithms::reconstructFromNodeAltitudes" 
)
inlinestatic

Reconstructs a typed image from topology storage and explicit node altitudes.

The reconstructed pixel type is the altitude type itself. This method does not clamp, convert, or validate altitude values; it only checks the buffer shape before indexing it through the topology.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.
contextOperation context or diagnostic label.
Returns
The reconstructed typed image from topology storage and explicit node altitudes.

Definition at line 275 of file TreeAltitudeAlgorithms.hpp.

◆ reconstructFromNodeContributions()

template<class Contribution >
requires (std::is_arithmetic_v<Contribution> && !std::is_same_v<std::remove_cv_t<Contribution>, bool>)
static ImagePtr< Contribution > mmcfilters::TreeAltitudeAlgorithms::reconstructFromNodeContributions ( const MorphologicalTree &  tree,
std::span< const Contribution >  nodeContributions,
const char *  context = "TreeAltitudeAlgorithms::reconstructFromNodeContributions" 
)
inlinestatic

Reconstructs an image by summing node contributions on every root-to-node branch.

The reconstruction baseline is fixed at zero. Therefore the accumulated value at the root is its own contribution, and each non-root accumulated value is the parent accumulation plus the node contribution.

Parameters
treeTree topology indexing the contribution buffer.
nodeContributionsDense contribution buffer indexed by internal node id.
contextOperation name used in diagnostics.
Returns
Image whose pixel value is the sum of contributions of all nodes containing that pixel.

Definition at line 303 of file TreeAltitudeAlgorithms.hpp.

◆ requireGlobalMonotoneAltitudeOrder()

static void mmcfilters::TreeAltitudeAlgorithms::requireGlobalMonotoneAltitudeOrder ( const MorphologicalTree &  tree,
const char *  context 
)
inlinestatic

Requires a declared globally monotone altitude order.

This constant-time requirement reads metadata without scanning altitude values. Use validateMonotoneNodeAltitudes to check an explicit altitude buffer.

Parameters
treeTree topology.
contextOperation name used in diagnostics.

Definition at line 123 of file TreeAltitudeAlgorithms.hpp.

◆ requireUInt8AltitudeValue()

template<AltitudeValue T>
static std::uint8_t mmcfilters::TreeAltitudeAlgorithms::requireUInt8AltitudeValue ( T  altitude,
NodeId  nodeId,
const char *  context 
)
inlinestatic

Converts one altitude value to uint8_t, rejecting values outside the output domain.

Parameters
altitudeAltitude data indexed by node identifier.
nodeIdDense internal node identifier.
contextOperation context or diagnostic label.
Returns
The converted one altitude value to uint8_t, rejecting values outside the output domain.

Definition at line 231 of file TreeAltitudeAlgorithms.hpp.

◆ validateFiniteAltitudeValue()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateFiniteAltitudeValue ( T  altitude,
std::size_t  index,
const char *  context 
)
inlinestatic

Rejects non-finite floating-point altitudes while compiling to a no-op for integral types.

Parameters
altitudeAltitude data indexed by node identifier.
indexZero-based index.
contextOperation context or diagnostic label.

Definition at line 148 of file TreeAltitudeAlgorithms.hpp.

◆ validateFiniteAltitudeValues()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateFiniteAltitudeValues ( std::span< const T >  altitude,
const char *  context 
)
inlinestatic

Rejects non-finite floating-point altitudes in a contiguous input range.

Parameters
altitudeAltitude data indexed by node identifier.
contextOperation context or diagnostic label.

Definition at line 165 of file TreeAltitudeAlgorithms.hpp.

◆ validateFiniteImageAltitudes()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateFiniteImageAltitudes ( const ImagePtr< T > &  image,
const char *  context 
)
inlinestatic

Rejects non-finite floating-point pixels before using an image as altitude source.

Parameters
imageImage.
contextOperation context or diagnostic label.

Definition at line 179 of file TreeAltitudeAlgorithms.hpp.

◆ validateMonotoneNodeAltitudes()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateMonotoneNodeAltitudes ( const MorphologicalTree &  tree,
std::span< const T >  altitude 
)
inlinestatic

Validates the hierarchy's declared global altitude order.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.

Definition at line 367 of file TreeAltitudeAlgorithms.hpp.

◆ validateNodeAltitudeBufferShape()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateNodeAltitudeBufferShape ( const MorphologicalTree &  tree,
std::span< const T >  altitude 
)
inlinestatic

Validates that an altitude buffer covers the dense internal-node domain.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.

Definition at line 136 of file TreeAltitudeAlgorithms.hpp.

◆ validateUInt8AltitudeDomain()

template<AltitudeValue T>
static void mmcfilters::TreeAltitudeAlgorithms::validateUInt8AltitudeDomain ( const MorphologicalTree &  tree,
std::span< const T >  altitude,
const char *  context 
)
inlinestatic

Validates all live node altitudes before materialising an ImageUInt8.

Parameters
treeTree topology.
altitudeAltitude data indexed by node identifier.
contextOperation context or diagnostic label.

Definition at line 255 of file TreeAltitudeAlgorithms.hpp.


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