MorphologicalAttributeFilters
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 WeightedMorphologicalTree< TcreateMaxTree (ImagePtr< T > img, double radius=1.5)
 Builds a typed weighted max-tree from an image.
 
template<AltitudeValue T>
static WeightedMorphologicalTree< TcreateMinTree (ImagePtr< T > img, double radius=1.5)
 Builds a typed weighted min-tree from an image.
 
static WeightedMorphologicalTree< std::uint8_t > createTreeOfShapes (ImageUInt8Ptr img, ToSInterpolation interpolation=ToSInterpolation::SelfDual, int infinitySeedRow=ToSDefaultInfinityRow, int infinitySeedCol=ToSDefaultInfinityCol)
 Builds a weighted tree of shapes from an 8-bit image.
 
template<AltitudeValue T>
static WeightedMorphologicalTree< TcreateFromHigraParent (std::span< const NodeId > higraParent, std::span< const T > higraAltitude, int rows, int cols, MorphologicalTreeKind kind, std::optional< AdjacencyRelation > adjacency=std::nullopt)
 Imports a static Higra parent/altitude hierarchy.
 
template<AltitudeValue T>
static WeightedMorphologicalTree< TcreateSelfDualResidualTree (ImagePtr< T > img, double radius=1.5)
 Builds a typed weighted self-dual residual tree from an image.
 

Detailed Description

Public construction facade for all high-level morphological trees.

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

Design contract:

Keeping construction in this factory prevents MorphologicalTree and WeightedMorphologicalTree<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 45 of file MorphologicalTreeFactory.hpp.

Member Function Documentation

◆ createFromHigraParent()

template<AltitudeValue T>
static WeightedMorphologicalTree< T > mmcfilters::MorphologicalTreeFactory::createFromHigraParent ( std::span< const NodeId higraParent,
std::span< const T higraAltitude,
int  rows,
int  cols,
MorphologicalTreeKind  kind,
std::optional< AdjacencyRelation 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 * cols leaves, leaf ids are [0, rows * cols) and internal ids are [rows * cols, 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
higraParentParent array in the compact Higra id domain.
higraAltitudeAltitudes in the same compact Higra id domain.
rowsNumber of rows in the image/proper-part domain.
colsNumber of columns in the image/proper-part 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 weighted 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 151 of file MorphologicalTreeFactory.hpp.

◆ createMaxTree()

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

Builds a typed weighted max-tree from an image.

Parameters
imgNon-null, non-empty image. Its row/column domain becomes the proper-part 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 WeightedMorphologicalTree<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 73 of file MorphologicalTreeFactory.hpp.

◆ createMinTree()

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

Builds a typed weighted min-tree from an image.

Parameters
imgNon-null, non-empty image. Its row/column domain becomes the proper-part 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 WeightedMorphologicalTree<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 93 of file MorphologicalTreeFactory.hpp.

◆ createSelfDualResidualTree()

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

Builds a typed weighted self-dual residual tree from an image.

The factory first creates the initial min-tree and max-tree using the same image and radius, then passes both weighted trees to sdrt::SelfDualResidualTreeBuilder<T>. The resulting native parent, proper-part owner, root, and altitude buffers are wrapped into a WeightedMorphologicalTree<T>. The image pixel type defines the SDRT altitude type; no arbitrary altitude conversion is performed.

Parameters
imgNon-null, non-empty image.
radiusRadius used both for the initial component trees and for the dual-tree adjustment adjacency.
Returns
A weighted tree whose topology has type MorphologicalTreeKind::SELF_DUAL_RESIDUAL_TREE.
Exceptions
std::invalid_argumentif the image domain is invalid.
std::runtime_errorif the SDRT build detects an inconsistent residual state.

Definition at line 178 of file MorphologicalTreeFactory.hpp.

◆ createTreeOfShapes()

static WeightedMorphologicalTree< std::uint8_t > mmcfilters::MorphologicalTreeFactory::createTreeOfShapes ( ImageUInt8Ptr  img,
ToSInterpolation  interpolation = ToSInterpolation::SelfDual,
int  infinitySeedRow = ToSDefaultInfinityRow,
int  infinitySeedCol = ToSDefaultInfinityCol 
)
inlinestatic

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

Parameters
imgNon-null, non-empty image.
interpolationInterpolation policy used by the ToS builder.
infinitySeedRowRow coordinate of the infinity seed expected by the underlying ToS construction.
infinitySeedColColumn coordinate of the infinity seed expected by the underlying ToS construction.
Returns
A WeightedMorphologicalTree<std::uint8_t> 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.

Definition at line 115 of file MorphologicalTreeFactory.hpp.


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