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

Public construction facade for all high-level morphological trees. More...

#include <MorphologicalTreeFactory.hpp>

Static Public Member Functions

template<AltitudeValue T>
static ValuedMorphologicalTree< T > createMaxTree (ImagePtr< T > img, double radius=1.5)
 Builds a typed valuedTree max-tree from an image.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createMaxTree (ImagePtr< T > img, RegularGridAdjacency2D adjacency)
 Builds a max-tree with an explicit regular-grid 2D adjacency.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createMinTree (ImagePtr< T > img, double radius=1.5)
 Builds a typed valuedTree min-tree from an image.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createMinTree (ImagePtr< T > img, RegularGridAdjacency2D adjacency)
 Builds a min-tree with an explicit regular-grid 2D adjacency.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createUnrestrictedResidualTree (ImagePtr< T > img, RegularGridAdjacency2D adjacency, sdrt::UnrestrictedResidualTreeOptions options={})
 Builds the unrestricted residual tree.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createUnrestrictedResidualTree (ImagePtr< T > img, double radius=1.5, sdrt::UnrestrictedResidualTreeOptions options={})
 Builds the unrestricted residual tree with a radius adjacency.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createSaturatedResidualTree (ImagePtr< T > img, RegularGridAdjacency2D adjacency, PixelId infinityPixel, sdrt::SaturatedResidualTreeOptions options={})
 Builds the saturated residual tree.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createSaturatedResidualTree (ImagePtr< T > img, PixelId infinityPixel, double radius=1.5, sdrt::SaturatedResidualTreeOptions options={})
 Builds the saturated residual tree with a radius adjacency.
 
template<class Altitude = std::uint8_t>
static ValuedMorphologicalTree< Altitude > createTreeOfShapes (ImageUInt8Ptr img, TopographicConvention convention={})
 Builds a valued tree of shapes from an 8-bit image.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createFromNativeHierarchy (NativeHierarchyView< T > hierarchy)
 Materializes the common output contract of a native producer.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createFromNativeTopology (std::span< const NodeId > parent, std::span< const NodeId > smallestNodeMap, std::span< const T > nodeAltitudes, NodeId root, MorphologicalTreeSemantics semantics)
 Imports a valued connected-subset tree from native buffers.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createFromNativeTopology (std::span< const NodeId > parent, std::span< const NodeId > smallestNodeMap, std::span< const T > nodeAltitudes, NodeId root, int rows, int columns, MorphologicalTreeSemantics semantics)
 Imports a native hierarchy with a regular 2D pixel layout.
 
template<AltitudeValue T>
static ValuedMorphologicalTree< T > createFromHigraParent (std::span< const NodeId > parent, std::span< const T > nodeAltitudes, int rows, int columns, MorphologicalTreeKind kind, std::optional< RegularGridAdjacency2D > adjacency=std::nullopt)
 Imports a static Higra parent/altitude hierarchy.
 

Detailed Description

Public construction facade for all high-level morphological trees.

MorphologicalTreeFactory is the single public entry point for creating tree instances from images and static Higra hierarchies. The factory owns only construction orchestration; it does not store mutable build state and every construction method returns a fully initialized valued-tree owner.

Design contract:

Keeping construction in this factory prevents MorphologicalTree and ValuedMorphologicalTree<std::uint8_t> from depending on public factory logic while still allowing their tag-based constructors to remain available for header-only composition inside this library.

Definition at line 54 of file MorphologicalTreeFactory.hpp.

Member Function Documentation

◆ createFromHigraParent()

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createFromHigraParent ( std::span< const NodeId parent,
std::span< const T >  nodeAltitudes,
int  rows,
int  columns,
MorphologicalTreeKind  kind,
std::optional< RegularGridAdjacency2D adjacency = std::nullopt 
)
inlinestatic

Imports a static Higra parent/altitude hierarchy.

Higra arrays use one compact id domain containing leaves followed by internal nodes. For an image domain with rows * columns leaves, leaf ids are [0, rows * columns) and internal ids are [rows * columns, parent.size()). Every leaf must point to an internal node, every internal node must point to another internal node or to itself, and exactly one internal node must be self-parented as the root.

Parameters
parentParent array in the compact Higra id domain.
nodeAltitudesAltitudes in the same compact Higra id domain.
rowsNumber of rows in the image/pixel domain.
columnsNumber of columns in the image/pixel domain.
kindSemantic tree kind represented by the imported hierarchy.
adjacencyRequired for max-tree and min-tree imports. Optional for tree-of-shapes imports, whose topology can be interpreted without a component-tree adjacency relation.
Returns
A typed valued tree whose internal altitude buffer has already been remapped from Higra ids to internal NodeId slots.
Exceptions
std::invalid_argumentif the hierarchy is malformed, if the altitude domain does not match the parent domain, or if a max/min import does not provide adjacency.

Definition at line 464 of file MorphologicalTreeFactory.hpp.

◆ createFromNativeHierarchy()

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createFromNativeHierarchy ( NativeHierarchyView< T >  hierarchy)
inlinestatic

Materializes the common output contract of a native producer.

Parameters
hierarchyHierarchy data.
Returns
The materialized common output contract of a native producer.

Definition at line 389 of file MorphologicalTreeFactory.hpp.

◆ createFromNativeTopology() [1/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createFromNativeTopology ( std::span< const NodeId parent,
std::span< const NodeId smallestNodeMap,
std::span< const T >  nodeAltitudes,
NodeId  root,
int  rows,
int  columns,
MorphologicalTreeSemantics  semantics 
)
inlinestatic

Imports a native hierarchy with a regular 2D pixel layout.

The row/column shape is optional metadata: it enables reconstruction and geometry-dependent algorithms but does not alter the topology contract.

Parameters
parentParent node indexed by internal node identifier.
smallestNodeMapPixel-indexed smallest node map.
nodeAltitudesAltitude data indexed by internal node identifier.
rootRoot node of the traversal.
rowsNumber of rows in the domain.
columnsNumber of columns in the domain.
semanticsHierarchy semantics validated by the operation.
Returns
The imported native hierarchy with a regular 2D pixel layout.

Definition at line 430 of file MorphologicalTreeFactory.hpp.

◆ createFromNativeTopology() [2/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createFromNativeTopology ( std::span< const NodeId parent,
std::span< const NodeId smallestNodeMap,
std::span< const T >  nodeAltitudes,
NodeId  root,
MorphologicalTreeSemantics  semantics 
)
inlinestatic

Imports a valued connected-subset tree from native buffers.

Node ids and pixel ids have independent domains. Consequently, any node, including the root, may have an empty proper part as long as the complete buffers encode one connected rooted hierarchy and every node has non-empty support.

Parameters
parentParent node indexed by internal node identifier.
smallestNodeMapPixel-indexed smallest node map.
nodeAltitudesAltitude data indexed by internal node identifier.
rootRoot node of the traversal.
semanticsHierarchy semantics validated by the operation.
Returns
The imported valued connected-subset tree.

Definition at line 409 of file MorphologicalTreeFactory.hpp.

◆ createMaxTree() [1/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createMaxTree ( ImagePtr< T >  img,
double  radius = 1.5 
)
inlinestatic

Builds a typed valuedTree max-tree from an image.

Parameters
imgNon-null, non-empty image. Its row/column domain becomes the pixel domain of the resulting tree, and its pixel type becomes the altitude type of the returned owner.
radiusRadius used by the component-tree adjacency relation.
Returns
A ValuedMorphologicalTree<T> whose topology is a max-tree and whose altitude buffer is indexed by internal NodeId.
Exceptions
std::invalid_argumentif the image domain is invalid.

Definition at line 195 of file MorphologicalTreeFactory.hpp.

◆ createMaxTree() [2/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createMaxTree ( ImagePtr< T >  img,
RegularGridAdjacency2D  adjacency 
)
inlinestatic

Builds a max-tree with an explicit regular-grid 2D adjacency.

The relation may be radius-, rectangle-, line-, or structuring-element-based. Its grid dimensions must match img.

Parameters
imgImage.
adjacencyAdjacency relation.
Returns
The resulting max-tree with an explicit regular-grid 2D adjacency.

Definition at line 215 of file MorphologicalTreeFactory.hpp.

◆ createMinTree() [1/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createMinTree ( ImagePtr< T >  img,
double  radius = 1.5 
)
inlinestatic

Builds a typed valuedTree min-tree from an image.

Parameters
imgNon-null, non-empty image. Its row/column domain becomes the pixel domain of the resulting tree, and its pixel type becomes the altitude type of the returned owner.
radiusRadius used by the component-tree adjacency relation.
Returns
A ValuedMorphologicalTree<T> whose topology is a min-tree and whose altitude buffer is indexed by internal NodeId.
Exceptions
std::invalid_argumentif the image domain is invalid.

Definition at line 238 of file MorphologicalTreeFactory.hpp.

◆ createMinTree() [2/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createMinTree ( ImagePtr< T >  img,
RegularGridAdjacency2D  adjacency 
)
inlinestatic

Builds a min-tree with an explicit regular-grid 2D adjacency.

Parameters
imgImage.
adjacencyAdjacency relation.
Returns
The resulting min-tree with an explicit regular-grid 2D adjacency.

Definition at line 255 of file MorphologicalTreeFactory.hpp.

◆ createSaturatedResidualTree() [1/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createSaturatedResidualTree ( ImagePtr< T >  img,
PixelId  infinityPixel,
double  radius = 1.5,
sdrt::SaturatedResidualTreeOptions  options = {} 
)
inlinestatic

Builds the saturated residual tree with a radius adjacency.

Parameters
imgImage processed by the operation.
infinityPixelRow-major infinity pixel.
radiusRadius of the regular-grid adjacency.
optionsSaturation and spatial-order policies.
Returns
A saturated residual tree using the radius adjacency.

Definition at line 343 of file MorphologicalTreeFactory.hpp.

◆ createSaturatedResidualTree() [2/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createSaturatedResidualTree ( ImagePtr< T >  img,
RegularGridAdjacency2D  adjacency,
PixelId  infinityPixel,
sdrt::SaturatedResidualTreeOptions  options = {} 
)
inlinestatic

Builds the saturated residual tree.

Only current regional extrema whose complement is connected to infinityPixel are eligible. The supplied adjacency must be symmetric, connected on the image domain, and shared by both component trees.

Parameters
imgImage processed by the operation.
adjacencyAdjacency relation.
infinityPixelRow-major infinity pixel.
optionsSaturation and spatial-order policies.
Returns
A saturated residual tree relative to infinityPixel.

Definition at line 321 of file MorphologicalTreeFactory.hpp.

◆ createTreeOfShapes()

template<class Altitude = std::uint8_t>
static ValuedMorphologicalTree< Altitude > mmcfilters::MorphologicalTreeFactory::createTreeOfShapes ( ImageUInt8Ptr  img,
TopographicConvention  convention = {} 
)
inlinestatic

Builds a valued tree of shapes from an 8-bit image.

The published altitude type must match the altitude encoding declared by the convention. The default convention selects the canonical minimum-4/maximum-8 complementary-grid immersion without domain padding, uses infinity pixel zero, and publishes unchanged 8-bit source levels. ToSGrayLevel altitudes are available under TopographicAltitudeEncoding::ExactDoubled. A self-dual span immersion requires that encoding when it retains an exterior ring; without the ring, TopographicAltitudeEncoding::UInt8 is also exact and admissible.

Template Parameters
AltitudePublished node-altitude type.
Parameters
imgNon-null, non-empty image.
conventionComplete topographic convention retained by the result.
Returns
A ValuedMorphologicalTree<Altitude> whose topology is a tree of shapes and whose altitude buffer is indexed by internal NodeId.
Exceptions
std::invalid_argumentif the image domain or ToS parameters are rejected by the underlying builder, or if Altitude contradicts the declared altitude encoding.

Definition at line 373 of file MorphologicalTreeFactory.hpp.

◆ createUnrestrictedResidualTree() [1/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createUnrestrictedResidualTree ( ImagePtr< T >  img,
double  radius = 1.5,
sdrt::UnrestrictedResidualTreeOptions  options = {} 
)
inlinestatic

Builds the unrestricted residual tree with a radius adjacency.

Parameters
imgImage processed by the operation.
radiusRadius of the regular-grid adjacency.
optionsSpatial-order options for unrestricted construction.
Returns
An unrestricted residual tree using the radius adjacency.

Definition at line 300 of file MorphologicalTreeFactory.hpp.

◆ createUnrestrictedResidualTree() [2/2]

template<AltitudeValue T>
static ValuedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createUnrestrictedResidualTree ( ImagePtr< T >  img,
RegularGridAdjacency2D  adjacency,
sdrt::UnrestrictedResidualTreeOptions  options = {} 
)
inlinestatic

Builds the unrestricted residual tree.

Current regional extrema from the synchronized max-tree and min-tree are selected by the self-dual residual schedule. Both component trees use the same symmetric connected adjacency.

Parameters
imgImage processed by the operation.
adjacencyAdjacency relation.
optionsSpatial-order options for unrestricted construction.
Returns
An unrestricted residual tree over adjacency.

Definition at line 279 of file MorphologicalTreeFactory.hpp.


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