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
|