Loading...
Searching...
No Matches
GapFillOp.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
32#ifndef GapFillerOP_H_
33#define GapFillerOP_H_
34
35#include <drain/image/ImageFile.h>
36#include <drain/util/Fuzzy.h>
37#include <drain/image/Intensity.h>
38//#include <drain/image/MathOpPack.h>
39#include "radar/Geometry.h"
40#include "RemoverOp.h"
41
42
43
44
45
46namespace rack {
47
48//using namespace drain::image;
49//using namespace hi5;
50
52
55class GapFillOpBase: public RemoverOp {
56
57public:
58
59 // Todo: windowConf ? with double?
60 int widthM = 0;
61 float heightD = 0;
62
63 // Originally for GapFillOpRec, but for combined op...
64 int loops = 0;
65 double expansionCoeff = 1.0;
66
67protected:
68
69 // "Removes detected anomalies by overriding low-quality pixels with neighboring high-quality pixels."
70
71 GapFillOpBase(const std::string &name, const std::string &description) :
72 RemoverOp(name, description){
73 dataSelector.setQuantities("^DBZH$");
74 };
75
76
77 virtual
78 void processData(const Data<PolarSrc> & srcData, Data<PolarDst> & dstData) const {
79 throw std::runtime_error(name +"::"+__FUNCTION__+ " not implemented");
80 };
81
82
83
84};
85
86
88
91class GapFillOp : public GapFillOpBase {
92
93public:
94
99 GapFillOp(int width = 1500, float height = 5.0) :
100 GapFillOpBase(__FUNCTION__,"Removes low-quality data with gap fill based on distance transformation.") {
101 parameters.link("width", this->widthM = width, "meters");
102 parameters.link("height", this->heightD = height, "degrees");
103 //parameters.link("loops", this->loops = 0, "N");
104 //parameters.link("expansionCoeff", this->expansionCoeff = 1, "window extension(1..2)");
105 parameters.link("qualityThreshold", this->qualityThreshold = 0.1, "0.0...1.0");
106 };
107
108
109protected:
110
111 // virtual void processData(const Data<PolarSrc> & srcData, Data<PolarDst> & dstData) const;
112
113 virtual
114 void processData(const PlainData<PolarSrc> & srcData, const PlainData<PolarSrc> & srcQuality,
115 PlainData<PolarDst> & dstData, PlainData<PolarDst> & dstQIND) const;
116
117 double qualityThreshold;
118
119};
120
121
124
125public:
126
127 //"width=1500m,height=5deg,loops=3,decay=0.9"
128 GapFillRecOp(int width=1500, float height=5.0, int loops=3) : //, float decay=0.9) :
129 GapFillOpBase(__FUNCTION__, "Recursive, 'splinic' gap filler.") {
130 parameters.link("width", this->widthM = width, "meters");
131 parameters.link("height",this->heightD = height, "degrees");
132 parameters.link("loops", this->loops = loops, "N");
133 //link("decay", this->decay, decay, "0..1");
134 //initialize();
135 };
136
137 //int loops;
138 //float decay;
139
140protected:
141
142 //virtualvoid processData(const Data<PolarSrc> & srcData, Data<PolarDst> & dstData) const;
143
144 virtual
145 void processData(const PlainData<PolarSrc> & srcData, const PlainData<PolarSrc> & srcQuality,
146 PlainData<PolarDst> & dstData, PlainData<PolarDst> & dstQIND) const;
147
148};
149
150
151
152} // rack::
153
154#endif /* GAPFILLOP_H_ */
155
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:282
Data structure consisting of plain data and an optional quality data.
Definition Data.h:1146
The base class for operators removing detected anomalies by overriding low-quality pixels with neighb...
Definition GapFillOp.h:55
virtual void processData(const Data< PolarSrc > &srcData, Data< PolarDst > &dstData) const
Cleaning a the data array of one quantity (measurement parameter). Called by processDataSet.
Definition GapFillOp.h:78
A simple gap filler based on distance transformation.
Definition GapFillOp.h:91
virtual void processData(const PlainData< PolarSrc > &srcData, const PlainData< PolarSrc > &srcQuality, PlainData< PolarDst > &dstData, PlainData< PolarDst > &dstQIND) const
TODO: move to data tools etc?
Definition GapFillOp.cpp:62
GapFillOp(int width=1500, float height=5.0)
Definition GapFillOp.h:99
Recursive, 'splinic' gap filler based on fast averaging.
Definition GapFillOp.h:123
Essential class for storing radar data.
Definition Data.h:300
The simplest possible anomaly removal operator and the base class for more complex ones.
Definition RemoverOp.h:53
Definition DataSelector.cpp:44