MorphologicalAttributeFilters
Public API documentation
Loading...
Searching...
No Matches
ContourSideAttributeComputer.hpp
1#pragma once
2
3#include "AttributeComputerDomain.hpp"
4#include "AttributeComputerFamily.hpp"
5#include "../detail/AttributeKernelSupport.hpp"
6#include "detail/ContourSideAttributeMaterialization.hpp"
7#include "detail/ContourSideLocalEventComputation.hpp"
8
9#include <array>
10#include <concepts>
11#include <span>
12#include <string_view>
13
14namespace mmcfilters::attributes::computers {
15
33public:
35 static constexpr std::string_view familyName = "contour-side";
36
38 static constexpr AttributeComputerFamily family = AttributeComputerFamily::ContourSide;
39
41 static constexpr AttributeComputerDomain domain = AttributeComputerDomain::Topology;
42
46 inline static constexpr std::array<Attribute, 6> producedAttributes{
47 CONTOUR_PIXELS,
48 CONTOUR_PERIMETER,
49 CONTOUR_SIDE_NORTH,
50 CONTOUR_SIDE_WEST,
51 CONTOUR_SIDE_EAST,
52 CONTOUR_SIDE_SOUTH};
53
64 template <std::floating_point Real>
66 computeImpl(
67 context.tree,
68 context.buffer,
69 context.attrNames,
70 context.requestedAttributes);
71 }
72
73private:
74 template <std::floating_point Real>
75 static void computeImpl(
76 const MorphologicalTree& tree,
77 std::span<Real> buffer,
79 std::span<const Attribute> requestedAttributes) {
80 const auto sideCounts = detail::ContourSideLocalEventComputation::computeContourSideCounts(tree);
81 detail::ContourSideAttributeMaterialization::materializeAttributesFromContourSideCounts(
82 tree,
84 buffer,
87 }
88
89public:
96 template <std::floating_point Real>
98 detail::ContourSideAttributeMaterialization::materializeUnitContourSideAttributes(
99 context.tree,
100 context.unitProperParts,
101 context.buffer,
102 context.attrNames,
103 context.requestedAttributes);
104 }
105};
106
107} // namespace mmcfilters::attributes::computers
Layout object that maps scalar attributes to flat-buffer offsets.
Mutable morphological tree built directly on proper parts and dense node ids.
static constexpr std::array< Attribute, 6 > producedAttributes
Canonical list of scalar contour attributes materialized by this computer.
static constexpr AttributeComputerDomain domain
Execution domain required by the computer.
static void computeUnitRows(const UnitAttributeComputeContext< Real > &context)
Materializes contour-side attributes for one-pixel unit supports.
static void compute(const AttributeComputeContext< Real > &context)
Computes requested contour-side scalar attributes for live nodes.
static constexpr std::string_view familyName
Family name used in dependency-plan diagnostics.
static constexpr AttributeComputerFamily family
Stable family id used by the scheduler.
Owning result for one computed scalar attribute layout and buffer.