Agroeye  1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
SegmentationParameters.h
Go to the documentation of this file.
1 #ifndef SEGMENTATIONPARAMETERS_H
2 #define SEGMENTATIONPARAMETERS_H
3 
4 #include <vector>
5 #include <unordered_map>
6 #include <unordered_set>
7 #include <algorithm>
8 
9 namespace agroeye {
10 namespace operations {
11 
15 enum class StatisticsTypes {
16  MEAN,
17  STDDEV
18 };
19 
20 using BandsList = std::vector<size_t>;
21 using StatisticsList = std::vector<StatisticsTypes>;
22 using BandsToStatsMap = std::unordered_map<size_t, StatisticsList>;
23 using StatsToBandsMap = std::unordered_map<StatisticsTypes, BandsList>;
29 class Parameters {
30 public:
31  Parameters() {};
32 
38  Parameters(BandsList bands);
39  Parameters(const Parameters& other) = default;
40  Parameters& operator=(const Parameters& other) = default;
41  Parameters(Parameters&& other) = default;
42  Parameters& operator=(Parameters&& other) = default;
43  virtual ~Parameters() {};
44 
49  void setSquareSide(size_t side);
50  size_t getSquareSide() const;
56  void setThreshold(double value) { threshold = value; };
57  double getThreshold() const { return threshold; }; //*< Obtains stored threshold value */
58 
59  BandsList getReadBands() const;
60  BandsList getSegmentationBands() const;
61  BandsList getStatisticsBands() const;
63  StatisticsList getStatsTypes() const;
69  StatisticsList getStatsToBand(size_t band) const;
70 
75  BandsList getBandsToStat(StatisticsTypes type) const;
76 
82  static std::string statisticEnumToName(const StatisticsTypes type);
83 
84 private:
85  // Bands participating in creation of statistics database
86  BandsToStatsMap bandsToStats;
87 
88  // Statistic type with bands pariticpating
89  StatsToBandsMap statsToBands;
90 
91  // Bands participating in segmentation
92  BandsList segmentationBands;
93 
94  // Bands participating in read from raster
95  BandsList readBands;
96 
97  StatisticsList statsTypes;
98  // Square Side used in chessboard segmentation
99  size_t squareSide {static_cast<size_t>(-1)};
100 
101  // Threshold in Quadtree segmentation
102  double threshold {-1.0};
103 };
104 
105 
106 } // namespace operations
107 } // namespace agroye
108 
109 
110 #endif
void setThreshold(double value)
Sets threshold value for quadtree segmentation.
Definition: SegmentationParameters.h:56
double getThreshold() const
Definition: SegmentationParameters.h:57
Definition: ContainerMath.h:11
Class encapsulating different segmentation parameters.
Definition: SegmentationParameters.h:29
std::unordered_map< size_t, StatisticsList > BandsToStatsMap
Definition: SegmentationParameters.h:22
std::vector< StatisticsTypes > StatisticsList
Definition: SegmentationParameters.h:21
std::unordered_map< StatisticsTypes, BandsList > StatsToBandsMap
Definition: SegmentationParameters.h:23
Parameters()
Definition: SegmentationParameters.h:31
virtual ~Parameters()
Definition: SegmentationParameters.h:43
std::vector< size_t > BandsList
Definition: SegmentationParameters.h:20
StatisticsTypes
Type of statistics that can be calculated.
Definition: SegmentationParameters.h:15