3#include "DistanceTransformTypes.hpp"
31 throw std::invalid_argument(
"NodeDistanceField requires a live node and matching non-empty sample arrays.");
34 for (std::size_t index = 0; index <
supportPixels_.size(); ++index) {
36 throw std::invalid_argument(
"NodeDistanceField samples must belong to the domain and have non-negative squared distances.");
64 for (std::size_t index = 0; index <
supportPixels_.size(); ++index) {
75 DistanceTransformAccuracy
accuracy_ = DistanceTransformAccuracy::Exact;
constexpr NodeId InvalidNode
Sentinel value used to denote an invalid node identifier.
Self-contained compact per-pixel distance field for one live node.
NodeId node() const noexcept
Returns the represented live internal node id.
std::vector< std::int64_t > denseSquaredDistances(std::int64_t outsideValue=-1) const
Returns a full-domain row-major field with outsideValue off support.
DistanceTransformAccuracy accuracy() const noexcept
Returns the numerical backend used to produce the field.
std::size_t size() const noexcept
Returns the number of compact support samples.
int columns() const noexcept
Returns the original domain width.
int rows() const noexcept
Returns the original domain height.
NodeDistanceField(NodeId node, int rows, int columns, DistanceTransformAccuracy accuracy, std::vector< PixelId > supportPixels, std::vector< std::int64_t > squaredDistances)
Constructs a self-contained compact node field.
std::span< const PixelId > supportPixels() const noexcept
Returns the row-major support pixel ids.
std::span< const std::int64_t > squaredDistances() const noexcept
Returns squared distances aligned with supportPixels().
Owning result for one computed scalar attribute layout and buffer.