File: image_analysis.h

package info (click to toggle)
wsclean 3.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,296 kB
  • sloc: cpp: 129,246; python: 22,066; sh: 360; ansic: 230; makefile: 185
file content (70 lines) | stat: -rw-r--r-- 2,400 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-License-Identifier: LGPL-3.0-only

#ifndef RADLER_ALGORITHMS_IUWT_IMAGE_ANALYSIS_H_
#define RADLER_ALGORITHMS_IUWT_IMAGE_ANALYSIS_H_

#include "algorithms/iuwt/iuwt_decomposition.h"

namespace radler::algorithms::iuwt::image_analysis {

struct Component {
  Component(size_t _x, size_t _y, int _scale) : x(_x), y(_y), scale(_scale) {}

  std::string ToString() const {
    std::ostringstream str;
    str << x << ',' << y << ", scale " << scale;
    return str.str();
  }

  size_t x;
  size_t y;
  int scale;
};

struct Component2D {
  Component2D(size_t _x, size_t _y) : x(_x), y(_y) {}

  std::string ToString() const {
    std::ostringstream str;
    str << x << ',' << y;
    return str.str();
  }

  size_t x;
  size_t y;
};

void SelectStructures(const IuwtDecomposition& iuwt, IuwtMask& mask,
                      const aocommon::UVector<float>& thresholds,
                      size_t min_scale, size_t end_scale, float clean_border,
                      const bool* prior_mask, size_t& area_size);

bool IsHighestOnScale0(const IuwtDecomposition& iuwt, IuwtMask& marked_mask,
                       size_t& x, size_t& y, size_t end_scale,
                       float& highest_scale0);

void Floodfill(const IuwtDecomposition& iuwt, IuwtMask& mask,
               const aocommon::UVector<float>& thresholds, size_t min_scale,
               size_t end_scale, const Component& component, float clean_border,
               size_t& area_size);

void MaskedFloodfill(const IuwtDecomposition& iuwt, IuwtMask& mask,
                     const aocommon::UVector<float>& thresholds,
                     size_t min_scale, size_t end_scale,
                     const Component& component, float clean_border,
                     const bool* prior_mask, size_t& area_size);

void FloodFill2D(const float* image, bool* mask, float threshold,
                 const Component2D& component, size_t width, size_t height,
                 size_t& area_size);

/**
 * Exactly like above, but now collecting the components in the
 * area vector, instead of returning just the area size.
 */
void FloodFill2D(const float* image, bool* mask, float threshold,
                 const Component2D& component, size_t width, size_t height,
                 std::vector<Component2D>& area);

}  // namespace radler::algorithms::iuwt::image_analysis
#endif  // RADLER_ALGORITHMS_IUWT_IMAGE_ANALYSIS_H_