67 const int numPixels =
image->getSize();
68 std::vector<PixelId>
orderedPixels(
static_cast<std::size_t
>(numPixels));
71 if constexpr (!std::is_same_v<PixelType, std::uint8_t>) {
73 std::cout <<
"Sorting image with comparison sort, size: " << numPixels << std::endl;
83 std::cout <<
"Sorting uint8 image with counting sort, size: " << numPixels << std::endl;
86 int maxValue =
static_cast<int>(values[0]);
87 for (
int index = 1; index < numPixels; ++index) {
93 std::vector<std::uint32_t>
counter(
static_cast<std::size_t
>(
maxValue) + 1, 0);
95 for (
int index = 0; index < numPixels; ++index) {
101 for (
int index = numPixels - 1; index >= 0; --index) {
105 for (
int index = 0; index < numPixels; ++index) {
111 for (
int index = numPixels - 1; index >= 0; --index) {
132 template <
typename PixelType>
137 const int numPixels =
image->getSize();
148 for (
int index = numPixels - 1; index >= 0; --index) {
152 for (
PixelId neighbor : detail::CommittedGridAccess::neighbors(adjacency_, pixel)) {
165 for (
int index = 0; index < numPixels; ++index) {
168 if (values[
pixelParent[parent]] == values[parent]) {
197 template <AltitudeValue T>
200 const MorphologicalTreeKind kind = isMaxTree_ ? MorphologicalTreeKind::MaxTree : MorphologicalTreeKind::MinTree;
203 std::vector<NodeId>
nodeParent(
static_cast<std::size_t
>(numNodes));
204 std::vector<T>
nodeValuation(
static_cast<std::size_t
>(numNodes));
205 std::vector<NodeId> smallestNode(
static_cast<std::size_t
>(
image->getSize()));
212 smallestNode[pixel] =
idNode;
217 smallestNode[pixel] = smallestNode[parent];
233 : adjacency_(std::move(adjacency)), isMaxTree_(
isMaxTree) {}
Shape metadata optionally attached to the pixel domain.
Records one adjacency shared by both construction polarities.