|
MorphologicalAttributeFilters
Public API documentation
|
Generic event engine for finite binary local computations. More...
#include <EventEngine.hpp>
Classes | |
| struct | WindowOffset |
| Relative integer offset of one sample in a local image window. More... | |
Static Public Member Functions | |
| static NodeId | entryNode (const MorphologicalTree &tree, int anchorPixel, int samplePixel) |
Returns the first ancestor of anchorPixel that contains samplePixel. | |
| static NodeId | entryNode (const MorphologicalTree &tree, int anchorPixel, WindowOffset offset) |
| Returns the entry node for one translated sample around an anchor. | |
| template<class Policy > | |
| static std::vector< typename Policy::Bucket > | computeDeltasWithPolicy (const MorphologicalTree &tree, const std::vector< WindowOffset > &window, const Policy &policy) |
| Computes local state-change deltas before subtree aggregation. | |
| template<class Policy > | |
| static std::vector< typename Policy::Bucket > | computeWithPolicy (const MorphologicalTree &tree, const std::vector< WindowOffset > &window, const Policy &policy) |
| Computes local counters with a caller-owned bucket policy. | |
Generic event engine for finite binary local computations.
This engine implements only the structural part of local event computation: entry-node evaluation, event ordering, local-state transitions, and bottom-up bucket aggregation. Attribute-specific headers own the meaning and type of their buckets.
The model is based on a finite window sampled around each anchor pixel. For each valid window sample, entryNode(...) returns the first node, walking upward from the anchor owner, whose support also contains that sample. Events are then processed from descendants to ancestors, so the binary state only gains visible samples. The policy receives the initial state and every later transition, and can store either raw state counters or an already projected attribute bucket.
Returned buffers always use the dense internal node-id space of MorphologicalTree; dead slots keep the default value of the policy bucket. This header is public so new local descriptors can reuse the same policy-based event model.
Definition at line 37 of file EventEngine.hpp.
|
inlinestatic |
Computes local state-change deltas before subtree aggregation.
The policy must define:
using Bucket = ...;applyInitial(Bucket&, uint32_t state);applyTransition(Bucket&, uint32_t oldState, uint32_t newState);merge(Bucket& parent, const Bucket& child).state is a bit mask over the samples in window. Bit i is set after the event for window[i] has entered. Because events are sorted bottom-up, transitions are monotone (newState is oldState plus one or more bits at the same node). The policy is responsible for interpreting a state and adding/removing the previous state's contribution.
Returned buckets are the sparse per-node delta representation: aggregating child buckets into parents materializes the final subtree attribute. Attribute implementations can expose this representation when callers need the local-event model itself rather than only final subtree counts.
| Policy | Policy type defining Bucket, applyInitial, applyTransition, and merge. |
| tree | Tree whose dense internal node-id space indexes the returned bucket vector. |
| window | Finite local window. At most 32 samples are supported because the active state is encoded in a uint32_t mask. |
| policy | Stateless or externally owned policy object used to update and merge buckets. |
tree.getNumInternalNodeSlots(). | std::invalid_argument | If the tree has no image domain, has no live root, or the window contains more than 32 samples. |
Definition at line 164 of file EventEngine.hpp.
|
inlinestatic |
Computes local counters with a caller-owned bucket policy.
This is computeDeltasWithPolicy(...) followed by bottom-up subtree aggregation with the policy's merge operation.
Let P be the number of image pixels, W the window size, N the number of internal node slots, and A the cost of owner/ancestor/LCA entry evaluation. The structural cost is:
O(P * W * A + P * W log W + N + E),
where E is the number of tree edges. Policy transition and merge costs are multiplied into the corresponding event and aggregation terms.
| Policy | Policy type defining Bucket, applyInitial, applyTransition, and merge. |
| tree | Tree whose dense internal node-id space indexes the returned bucket vector. |
| window | Finite local window. At most 32 samples are supported. |
| policy | Stateless or externally owned policy object used to update and merge buckets. |
tree.getNumInternalNodeSlots(). | std::invalid_argument | If the tree/window shape is invalid. |
Definition at line 243 of file EventEngine.hpp.
|
inlinestatic |
Returns the first ancestor of anchorPixel that contains samplePixel.
The entry node is the structural point where a binary local sample becomes visible while the anchor support is expanded from a node to its ancestors:
Invalid pixels or pixels without an owner return InvalidNode.
| tree | Morphological tree whose proper-part ownership defines the supports being sampled. |
| anchorPixel | Row-major image-domain proper part used as the window anchor. |
| samplePixel | Row-major image-domain proper part being tested. |
NodeId where the sample enters, or InvalidNode when either pixel is invalid or unowned. Definition at line 87 of file EventEngine.hpp.
|
inlinestatic |
Returns the entry node for one translated sample around an anchor.
This overload converts offset to an absolute sample pixel in the image domain and returns InvalidNode when the translated sample falls outside the image. Out-of-domain samples therefore do not generate local events; attribute policies that need border complements account for them through their own framed-window logic.
| tree | Morphological tree whose image domain defines valid samples. |
| anchorPixel | Row-major image-domain proper part used as the window anchor. |
| offset | Relative window sample offset. |
NodeId where the translated sample enters, or InvalidNode if the anchor/sample is outside the image or unowned. Definition at line 108 of file EventEngine.hpp.