|
| template<AltitudeValue T> |
| static WeightedMorphologicalTree< T > | createMaxTree (ImagePtr< T > img, double radius=1.5) |
| | Builds a typed weighted max-tree from an image.
|
| |
| template<AltitudeValue T> |
| static WeightedMorphologicalTree< T > | createMinTree (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< T > | createFromHigraParent (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< T > | createSelfDualResidualTree (ImagePtr< T > img, double radius=1.5) |
| | Builds a typed weighted self-dual residual tree from an image.
|
| |
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:
- image-driven builders create the topology first and then infer one altitude value per internal node from the source image;
- Higra imports preserve the external Higra node-id domain for altitude mapping, then expose the result through the internal dense
NodeId domain;
- SDRT construction delegates the iterative residual build to
sdrt::SelfDualResidualTreeBuilder<T> and only wraps the materialized buffers into the standard weighted tree representation;
- callers that only need topology should use
WeightedMorphologicalTree<std::uint8_t>::topology() instead of constructing a bare MorphologicalTree directly;
- max/min image factories derive altitude type from the image type.
uint8_t uses counting sort; other supported altitude values use comparison sort;
- static Higra imports can preserve a non-canonical altitude type because the altitude array itself supplies that type.
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.
template<AltitudeValue T>
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
-
| higraParent | Parent array in the compact Higra id domain. |
| higraAltitude | Altitudes in the same compact Higra id domain. |
| rows | Number of rows in the image/proper-part domain. |
| cols | Number of columns in the image/proper-part domain. |
| kind | Semantic tree kind represented by the imported hierarchy. |
| adjacency | Required 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_argument | if 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.
template<AltitudeValue T>
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
-
| img | Non-null, non-empty image. |
| radius | Radius 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_argument | if the image domain is invalid. |
| std::runtime_error | if the SDRT build detects an inconsistent residual state. |
Definition at line 178 of file MorphologicalTreeFactory.hpp.