Loading...
Searching...
No Matches
FuzzyDetectorOp.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31#ifndef RACK_FUZZY_DUALPOL_OP
32#define RACK_FUZZY_DUALPOL_OP
33
34#include <string>
35
36#include <drain/util/Cloner.h>
37
38#include <drain/image/Image.h>
39#include <drain/image/Window.h>
40#include <drain/imageops/ImageOp.h>
41
42#include "radar/Analysis.h"
43#include "DetectorOp.h"
44
45namespace rack {
46
47
49/*
50 * \see drain::Cloner
51 * \see drain::FunctorBank
52 */
55
56public:
57
58 template <class T>
59 T & clone(){
60 return getCloner<T>().getClonedSrc();
61 }
62
63
64protected:
65
66 template <class T>
69 // cloner.drop(1);
70 return cloner;
71 }
72
73};
74
76
80
81protected:
82
84 inline
85 FuzzyDetectorOp(const std::string & name, const std::string & description, const std::string & classCode) :
87 // dataSelector.setQuantities("DBZ:VRAD:RHOHV:ZDR");
88 dataSelector.setQuantities("DBZH:VRADH:RHOHV:ZDR"); // must add this, at least DBZH to start
89 //dataSelector.setQuantities("");
90 };
91
92
94 inline
98
99 virtual inline
101
102 drain::Range<double> dbzParam = {-5.0,+5.0}; // Peak(span) or threshold(area), hence called generally "parameter".
103 double vradDevThreshold = 2.0;
104 //double rhoHVthreshold = 0.95;
105 drain::Range<double> rhoHVthreshold = {0.85,0.95};
106 double zdrAbsThreshold = 2.0;
108 // RadarWindowConfig windowConf;
109 double gammaAdjustment = 1.0; // neutral value, post-processing
110
111 virtual inline
112 const QuantitySelector & getSelectorDBZ() const {
113 return selectorEmpty; // return selectorDBZ;
114 };
115
116 virtual inline
117 const QuantitySelector & getSelectorVRAD() const {
118 return selectorEmpty; // return selectorVRAD;
119 };
120
121 virtual inline
122 const QuantitySelector & getSelectorZDR() const {
123 return selectorEmpty; // return selectorZDR;
124 };
125
126 virtual inline
127 const QuantitySelector & getSelectorRHOHV() const {
128 return selectorEmpty; //return selectorRHOHV;
129 };
130
131 virtual
132 void runDetection(const DataSet<PolarSrc> & src, PlainData<PolarDst> & dstProb, DataSet<PolarDst> & dstAux) const;
133
134
135
136
137 virtual inline
138 drain::Fuzzifier<double> & getFuzzifierDBZ(LocalFunctorBank & bank) const {
139 return dummy;
140 }
141
142 virtual inline
143 drain::Fuzzifier<double> & getFuzzifierVRAD(LocalFunctorBank & bank) const {
144 return dummy;
145 }
146
147 virtual inline
148 drain::Fuzzifier<double> & getFuzzifierZDR(LocalFunctorBank & bank) const {
149 return dummy; // or 1.0
150 }
151
152 virtual inline
153 drain::Fuzzifier<double> & getFuzzifierRHOHV(LocalFunctorBank & bank) const {
154 return dummy;
155 }
156
157
158
159 virtual
160 void computeFuzzy(const drain::Fuzzifier<double> & fuzzifier, const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const; // = 0;
161
162 virtual
163 void computeFuzzyVRAD(const drain::Fuzzifier<double> & fuzzifier, const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const; // = 0;
164
165
167
171 void applyOperator(const ImageOp & op, const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProductAux) const;
172
174 static
175 void getGammaLookUpTable(double p, std::vector<unsigned char> & lookUpTable);
176
177protected:
178
179 static const QuantitySelector selectorEmpty;
180 static const QuantitySelector selectorDBZ;
181 static const QuantitySelector selectorVRAD;
182 static const QuantitySelector selectorZDR;
183 static const QuantitySelector selectorRHOHV;
184
185 static drain::FuzzyIdentity<double> dummy;
186
187public:
188
189 // mutable
190 // RadarFunctorOp<drain::IdentityFunctor> dummyFunctorOp;
191};
192
193
194}
195
196#endif
197
198// Rack
const std::string description
Brief, human-readable description of this bean.
Definition BeanLike.h:309
map_t parameters
Parameters (name -> linked variable), typically linked to member variables of the derived class.
Definition BeanLike.h:313
const map_t & getParameters() const
Returns the parameter map (const access).
Definition BeanLike.h:116
const std::string name
Name of this bean, typically also the name of the (derived) class.
Definition BeanLike.h:306
A base class for fuzzy functions; also an unary functor.
Definition Fuzzy.h:62
Identity function - returns the input value.
Definition Fuzzy.h:128
Definition Range.h:52
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition ReferenceMap.h:412
Base class for image processing functions.
Definition ImageOp.h:49
Base class for configurations applied in image processing windows, e.g. for operators of type WindowO...
Definition Window.h:55
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:299
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
Base class for anomaly detectors.
Definition DetectorOp.h:49
Base class for BirdOp and InsectOp.
Definition FuzzyDetectorOp.h:79
FuzzyDetectorOp(const std::string &name, const std::string &description, const std::string &classCode)
Constructor.
Definition FuzzyDetectorOp.h:85
void applyOperator(const ImageOp &op, const PlainData< PolarSrc > &src, PlainData< PolarDst > &dstData, DataSet< PolarDst > &dstProductAux) const
Convenience function for "accumulating" detection results.
Definition FuzzyDetectorOp.cpp:134
virtual void runDetection(const DataSet< PolarSrc > &src, PlainData< PolarDst > &dstProb, DataSet< PolarDst > &dstAux) const
Process as sweep (data in one elevation angle)
Definition FuzzyDetectorOp.cpp:215
static void getGammaLookUpTable(double p, std::vector< unsigned char > &lookUpTable)
Returns a 256-element map of Gamma corrected values, scaled by 256.
Definition FuzzyDetectorOp.cpp:116
FuzzyDetectorOp(const FuzzyDetectorOp &op)
Copy constructor.
Definition FuzzyDetectorOp.h:95
DOC: Add class description.
Definition FuzzyDetectorOp.h:54
Definition AltitudeOp.cpp:42
Wrapper for derived class S, returning base class T.
Definition Cloner.h:118