File: thresholdconfig.h

package info (click to toggle)
aoflagger 3.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,960 kB
  • sloc: cpp: 83,076; python: 10,187; sh: 260; makefile: 178
file content (75 lines) | stat: -rw-r--r-- 2,222 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
71
72
73
74
75
#ifndef THRESHOLDCONFIG_H
#define THRESHOLDCONFIG_H

#include <vector>

#include "../structures/image2d.h"
#include "../structures/mask2d.h"

namespace algorithms {

class ThresholdConfig {
 public:
  enum Distribution { Gaussian, Rayleigh };
  ThresholdConfig();

  void InitializeLengthsDefault(unsigned count = 0);

  void InitializeLengthsSingleSample();

  void InitializeThresholdsFromFirstThreshold(num_t firstThreshold,
                                              Distribution noiseDistribution);

  void Execute(const Image2D* image, Mask2D* mask, bool additive,
               num_t timeSensitivity, num_t frequencySensitivity) const;
  void ExecuteWithMissing(const Image2D* image, Mask2D* mask,
                          const Mask2D* missing, bool additive,
                          num_t timeSensitivity,
                          num_t frequencySensitivity) const;

  num_t GetHorizontalThreshold(unsigned index) const {
    return _horizontalOperations[index].threshold;
  }

  num_t GetVerticalThreshold(unsigned index) const {
    return _verticalOperations[index].threshold;
  }

  void SetHorizontalThreshold(unsigned index, num_t threshold) {
    _horizontalOperations[index].threshold = threshold;
  }

  void SetVerticalThreshold(unsigned index, num_t threshold) {
    _verticalOperations[index].threshold = threshold;
  }

  size_t GetHorizontalLength(unsigned index) const {
    return _horizontalOperations[index].length;
  }

  size_t GetVerticalLength(unsigned index) const {
    return _verticalOperations[index].length;
  }

  size_t GetHorizontalOperations() const {
    return _horizontalOperations.size();
  }
  size_t GetVerticalOperations() const { return _horizontalOperations.size(); }
  void RemoveHorizontalOperations() { _horizontalOperations.clear(); }
  void RemoveVerticalOperations() { _verticalOperations.clear(); }

 private:
  struct ThresholdOperation {
    explicit ThresholdOperation(size_t length_)
        : length(length_), threshold(0) {}
    size_t length;
    num_t threshold;
  };
  std::vector<ThresholdOperation> _horizontalOperations;
  std::vector<ThresholdOperation> _verticalOperations;
  Distribution _distribution;
};

}  // namespace algorithms

#endif