MorphologicalAttributeFilters
Public API documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
mmcfilters::adjust::DynamicTreeAttributeComputer< T > Class Template Referenceabstract

Common protocol for attributes maintained during local tree adjustment. More...

#include <DynamicTreeAttributeComputer.hpp>

Inheritance diagram for mmcfilters::adjust::DynamicTreeAttributeComputer< T >:
Inheritance graph
[legend]

Public Types

using buffer_type = std::vector< double >
 Dense per-node attribute buffer used by dynamic adjustment computers.
 

Public Member Functions

virtual ~DynamicTreeAttributeComputer ()=default
 Destroys a dynamic attribute computer through the protocol base.
 
virtual void resize (const WeightedMorphologicalTree< T > &tree, buffer_type &buffer) const
 Resizes an attribute buffer to the full internal node-id space.
 
virtual void preProcessing (NodeId nodeId, const WeightedMorphologicalTree< T > &tree, buffer_type &buffer) const =0
 Initializes the direct contribution of one node before child merges.
 
virtual void mergeProcessing (NodeId parentId, NodeId childId, const WeightedMorphologicalTree< T > &tree, buffer_type &buffer) const =0
 Accumulates an already-current child contribution into its parent.
 
virtual void postProcessing (NodeId nodeId, const WeightedMorphologicalTree< T > &tree, buffer_type &buffer) const =0
 Materializes the final scalar value for one node after all child merges.
 
virtual void onMoveProperParts (NodeId, NodeId, const WeightedMorphologicalTree< T > &) const
 Incremental hook called after all direct proper parts move from one node to another.
 
virtual void onMoveProperPart (NodeId, NodeId, NodeId, const WeightedMorphologicalTree< T > &) const
 Incremental hook called after one proper part moves between nodes.
 
virtual void onNodeRemoved (NodeId, const WeightedMorphologicalTree< T > &) const
 Incremental hook called when one node slot is released from the live tree.
 
void computeAttribute (const WeightedMorphologicalTree< T > &tree, buffer_type &buffer) const
 Computes the attribute for the full current tree in post-order.
 
void computeAttributeOnNode (const WeightedMorphologicalTree< T > &tree, NodeId nodeId, buffer_type &buffer) const
 Recomputes one node assuming all direct children are already up to date.
 

Detailed Description

template<AltitudeValue T>
class mmcfilters::adjust::DynamicTreeAttributeComputer< T >

Common protocol for attributes maintained during local tree adjustment.

The dual min/max-tree adjuster performs structural edits that are local to the affected component. Recomputing every node attribute after each edit would change the practical cost profile of the connected alternating sequential filter, so attributes used by the CASF follow the same incremental contract as the Higra implementation:

Buffers are indexed in this project's dense internal NodeId space, not in Higra's global leaf+node id space. This is the main representation difference relative to the source algorithm and keeps the implementation compatible with WeightedMorphologicalTree<T>.

Definition at line 50 of file DynamicTreeAttributeComputer.hpp.

Member Typedef Documentation

◆ buffer_type

template<AltitudeValue T>
using mmcfilters::adjust::DynamicTreeAttributeComputer< T >::buffer_type = std::vector<double>

Dense per-node attribute buffer used by dynamic adjustment computers.

Definition at line 53 of file DynamicTreeAttributeComputer.hpp.

Member Function Documentation

◆ computeAttribute()

template<AltitudeValue T>
void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::computeAttribute ( const WeightedMorphologicalTree< T > &  tree,
buffer_type buffer 
) const
inline

Computes the attribute for the full current tree in post-order.

This is used to bootstrap the buffers before the first adjustment step and as a reference-compatible full computation. Adjustment steps later refresh only the nodes marked by local structural changes.

Parameters
treeCurrent mutable weighted tree state.
bufferDense output buffer. It is resized before computation.

Definition at line 145 of file DynamicTreeAttributeComputer.hpp.

◆ computeAttributeOnNode()

template<AltitudeValue T>
void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::computeAttributeOnNode ( const WeightedMorphologicalTree< T > &  tree,
NodeId  nodeId,
buffer_type buffer 
) const
inline

Recomputes one node assuming all direct children are already up to date.

Parameters
treeCurrent mutable weighted tree state.
nodeIdLive dense internal node id to refresh.
bufferDense output buffer already sized for the tree.

Definition at line 164 of file DynamicTreeAttributeComputer.hpp.

◆ mergeProcessing()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::mergeProcessing ( NodeId  parentId,
NodeId  childId,
const WeightedMorphologicalTree< T > &  tree,
buffer_type buffer 
) const
pure virtual

Accumulates an already-current child contribution into its parent.

Parameters
parentIdLive dense internal parent node id.
childIdLive dense internal child node id whose buffer entry is already current.
treeCurrent mutable weighted tree state.
bufferDense per-node output buffer.

Implemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >, and mmcfilters::adjust::DynamicAreaAttributeComputer< T >.

◆ onMoveProperPart()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::onMoveProperPart ( NodeId  ,
NodeId  ,
NodeId  ,
const WeightedMorphologicalTree< T > &   
) const
inlinevirtual

Incremental hook called after one proper part moves between nodes.

Default implementation is a no-op so concrete computers override only the structural events they need.

The parameters are proper-part id, source node id, destination node id, and current tree state.

Reimplemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >.

Definition at line 123 of file DynamicTreeAttributeComputer.hpp.

◆ onMoveProperParts()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::onMoveProperParts ( NodeId  ,
NodeId  ,
const WeightedMorphologicalTree< T > &   
) const
inlinevirtual

Incremental hook called after all direct proper parts move from one node to another.

Default implementation is a no-op so concrete computers override only the structural events they need.

The parameters are source node id, destination node id, and current tree state. Implementations that maintain direct-proper-part caches can use this event to move or invalidate cached summaries without a full rebuild.

Reimplemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >.

Definition at line 113 of file DynamicTreeAttributeComputer.hpp.

◆ onNodeRemoved()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::onNodeRemoved ( NodeId  ,
const WeightedMorphologicalTree< T > &   
) const
inlinevirtual

Incremental hook called when one node slot is released from the live tree.

Default implementation is a no-op so concrete computers override only the structural events they need.

Implementations should clear or invalidate any auxiliary state indexed by the released dense internal node id.

Reimplemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >.

Definition at line 133 of file DynamicTreeAttributeComputer.hpp.

◆ postProcessing()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::postProcessing ( NodeId  nodeId,
const WeightedMorphologicalTree< T > &  tree,
buffer_type buffer 
) const
pure virtual

Materializes the final scalar value for one node after all child merges.

Parameters
nodeIdLive dense internal node id being finalized.
treeCurrent mutable weighted tree state.
bufferDense per-node output buffer.

Implemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >, and mmcfilters::adjust::DynamicAreaAttributeComputer< T >.

◆ preProcessing()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::preProcessing ( NodeId  nodeId,
const WeightedMorphologicalTree< T > &  tree,
buffer_type buffer 
) const
pure virtual

Initializes the direct contribution of one node before child merges.

Parameters
nodeIdLive dense internal node id being recomputed.
treeCurrent mutable weighted tree state.
bufferDense per-node output buffer.

Implemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >, and mmcfilters::adjust::DynamicAreaAttributeComputer< T >.

◆ resize()

template<AltitudeValue T>
virtual void mmcfilters::adjust::DynamicTreeAttributeComputer< T >::resize ( const WeightedMorphologicalTree< T > &  tree,
buffer_type buffer 
) const
inlinevirtual

Resizes an attribute buffer to the full internal node-id space.

Released slots remain addressable while the dynamic adjustment is running, so buffers are sized by the number of allocated internal node slots rather than by the number of currently alive nodes.

Parameters
treeWeighted tree whose internal node-slot domain defines the buffer size.
bufferOutput buffer resized to the full internal node-slot count.

Reimplemented in mmcfilters::adjust::DynamicBoundingBoxAttributeComputer< T >.

Definition at line 71 of file DynamicTreeAttributeComputer.hpp.


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