QualityCombinerOp.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 
32 #ifndef QualityCombiner_SEGMENT_OP_H_
33 #define QualityCombiner_SEGMENT_OP_H_
34 
35 #include <drain/image/ImageFile.h>
36 #include "drain/util/Functor.h"
37 
38 #include "product/PolarProductOp.h" // why
39 #include "AndreOp.h"
40 
41 
42 
43 using namespace drain::image;
44 
45 namespace rack {
46 
49 
50 public:
51 
52  DataMarker() : drain::UnaryFunctor(__FUNCTION__), value(0.5) {
53 
54  }
55 
56  inline
57  void set(double value){
58  this->value = value;
59  //this->update();
60  }
61 
62 
63  inline
64  double operator()(double x) const {
65  return value;
66  }
67 
68  double value;
69 
70 };
71 
73 /*
74 class DefaultOp: public PolarProductOp { // VolumeOp<PolarODIM>
75 
76 public:
77 
78  DefaultOp() :
79  PolarProductOp(__FUNCTION__,"Combines detection probabilities to overall quality field QIND (and CLASS).") // VolumeOp<PolarODIM>
80  {
81 
82  }
83 
84 
85 }
86 */
87 
89 class QualityCombinerOp: public AndreOp { // PolarProductOp {
90 
91 public:
92 
94  //PolarProductOp(__FUNCTION__,"Combines detection probabilities to overall quality field QIND (and CLASS).") // VolumeOp<PolarODIM>
95  AndreOp(__FUNCTION__,"Combines detection probabilities to overall quality field QIND (and CLASS).") // VolumeOp<PolarODIM>
96  {
97  // dataSelector.path = "/da ta[0-9]+$";
98  dataSelector.setQuantityRegExp("^DBZH$");
99 
100  allowedEncoding.clear();
101  }
102 
103  inline
104  ~QualityCombinerOp(){};
105 
107  static
108  void updateOverallQuality(const PlainData<PolarSrc> & srcQind, const PlainData<PolarSrc> & srcClass, PlainData<PolarDst> & dstQind, PlainData<PolarDst> & dstClass); // const;
109 
111 
117  static
118  void updateOverallDetection(const drain::image::ImageFrame & srcProb, PlainData<PolarDst> & dstQind, PlainData<PolarDst> & dstClass, const std::string &label, unsigned short index); // const;
119  //void updateOverallDetection(const PlainData<PolarSrc> & srcProb, PlainData<PolarDst> & dstQind, PlainData<PolarDst> & dstClass, const std::string &label, unsigned short index); // const;
120 
121  /*
122  static
123  void updateOverallDetection(const drain::image::ImageFrame & srcProb, drain::image::ImageFrame & dstQind, drain::image::ImageFrame & dstClass,
124  const std::string &label, unsigned short index); // const;
125  */
126 
127 
129  static
130  void updateLocalQuality(const DataSet<PolarSrc> & srcDataSet, Data<PolarDst> & dstData);
131 
133  //static double DEFAULT_QUALITY;
134 
135 
139  static
140  //void initDstQuality(const PlainData<PolarSrc> & srcData, PlainData<PolarDst> & dstQuality, const std::string & quantity = "");
141  void initDstQuality(const PolarODIM & srcODIM, PlainData<PolarDst> & dstQuality, const std::string & quantity);
142 
143 protected:
144 
145 
146  virtual
147  void processDataSet(const DataSet<PolarSrc> & srcSweep, DataSet<PolarDst> & dstProduct) const;
148 
149 
150 };
151 
152 } // rack::
153 
154 #endif
Image with static geometry.
Definition: ImageFrame.h:67
The base class for detector and removal operators.
Definition: AndreOp.h:55
Simple class marking true data with a given constant value, typically a CLASS label.
Definition: QualityCombinerOp.h:48
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition: Data.h:1213
Data structure consisting of plain data and an optional quality data.
Definition: Data.h:1144
Essential class for storing radar data.
Definition: Data.h:302
Metadata structure for single-radar data (polar scans, volumes and products).
Definition: PolarODIM.h:45
A quick QualityCombiner .
Definition: QualityCombinerOp.h:89
Namespace for images and image processing tools.
Definition: AccumulationArray.cpp:45
Definition: DataSelector.cpp:44
Definition: Functor.h:116