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

Incremental foreground A4 contours on the image domain. More...

#include <ContourComputation.hpp>

Classes

class  iterator
 Single-pass iterator yielding (node, borrowed pixel span). More...
 

Public Member Functions

 ContourComputation (const MorphologicalTree &tree)
 Builds the compact indexes for a stable tree with a 2D domain.
 
template<AltitudeValue T>
 ContourComputation (const ValuedMorphologicalTreeView< T > &view)
 Builds contours from the topology of a current valued view.
 
std::vector< PixelIdcontour (NodeId node) const
 Returns an owned contour of one live node, without caching it.
 
iterator begin () const
 Starts an independent incremental post-order traversal.
 
std::default_sentinel_t end () const noexcept
 Returns the exhaustion sentinel.
 
template<typename Consumer >
void forEachContour (Consumer &&consumer) const
 Calls consumer(node, pixels) once for every live node.
 

Detailed Description

Incremental foreground A4 contours on the image domain.

Stores compact support and boundary-lifetime indexes, without a contour cache. Iteration emits every live node in post-order, reusing child storage. A query for one node scans only the requested support and returns an owned pixel vector. The tree must outlive this object and its iterators, and remain unchanged. Index construction and each traversal use O(P + N) auxiliary storage, where P counts pixels and N internal node slots. The tree resolves comparable pairs of smallest nodes from DFS intervals, then selects the lower estimated storage between RMQ and offline Tarjan for the remaining batch. This bound excludes caller-retained output and pre-existing tree-owned LCA caches. Pixel order is unspecified.

Definition at line 29 of file ContourComputation.hpp.

Constructor & Destructor Documentation

◆ ContourComputation() [1/2]

mmcfilters::ContourComputation::ContourComputation ( const MorphologicalTree tree)
inlineexplicit

Builds the compact indexes for a stable tree with a 2D domain.

Parameters
treeSource topology, which must outlive the computation.

Definition at line 139 of file ContourComputation.hpp.

◆ ContourComputation() [2/2]

template<AltitudeValue T>
mmcfilters::ContourComputation::ContourComputation ( const ValuedMorphologicalTreeView< T > &  view)
inlineexplicit

Builds contours from the topology of a current valued view.

Parameters
viewCurrent valued view whose topology must outlive the computation.

Definition at line 146 of file ContourComputation.hpp.

Member Function Documentation

◆ begin()

iterator mmcfilters::ContourComputation::begin ( ) const
inline

Starts an independent incremental post-order traversal.

Returns
Single-pass iterator positioned at the first contour, or exhausted.

Definition at line 168 of file ContourComputation.hpp.

◆ contour()

std::vector< PixelId > mmcfilters::ContourComputation::contour ( NodeId  node) const
inline

Returns an owned contour of one live node, without caching it.

Parameters
nodeLive internal node identifier.
Returns
Foreground boundary pixels, obtained in O(|support(node)|) time.

Definition at line 153 of file ContourComputation.hpp.

◆ end()

std::default_sentinel_t mmcfilters::ContourComputation::end ( ) const
inlinenoexcept

Returns the exhaustion sentinel.

Returns
Sentinel shared by all contour traversals.

Definition at line 177 of file ContourComputation.hpp.

◆ forEachContour()

template<typename Consumer >
void mmcfilters::ContourComputation::forEachContour ( Consumer &&  consumer) const
inline

Calls consumer(node, pixels) once for every live node.

Uses the same iterator. The borrowed span expires after the callback; exceptions propagate and release the traversal's temporary storage.

Parameters
consumerCallback accepting a node identifier and borrowed contour span.

Definition at line 186 of file ContourComputation.hpp.


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