Loading...
Searching...
No Matches
JammingOp.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 Jamming2_OP_H_
33#define Jamming2_OP_H_
34
35#include <limits>
36
37//#include <drain/util/FunctorPack.h>
38//#include <drain/util/Math.h>
39
40/*
41#include <drain/image/File.h>
42#include <drain/imageops/RunLengthOp.h>
43#include <drain/imageops/DistanceTransformOp.h>
44*/
45
46
47#include "DetectorOp.h"
48
49
50//using namespace drain::image;
51
52using namespace drain::image;
53
54namespace rack {
55
57
64class JammingOp: public DetectorOp {
65
66public:
67
76 // \param derivativeDifferenceMax - maximum difference between modelled and detected dBZ(range) slopes.
77 // \param windowWidth - windowWidth [kilometres]
78 // JammingOp(int windowWidth=5000, float windowHeight=10.0, float sensitivity = 0.5, float eWidth = 1.0f, float eHeight = 0.0f) :
79 // JammingOp(double smoothnessThreshold = 5.0, double sampleContent=0.5, double weightLower = 0.1, double maxCurvature = 0.001, double distanceMin = 40.0, int debugRow=-1) :
80 JammingOp(double smoothnessThreshold = 5.0, double distanceMin = 80.0, double refit=true, int debugRow=-1) : // , double derivativeDifferenceMax = 0.0001
81 DetectorOp(__FUNCTION__, "Detects broad lines caused by electromagnetic interference. Intensities should be smooth, increasing by distance.",
82 "jamming")
83 {
84 parameters.link("smoothnessThreshold", this->smoothnessThreshold = smoothnessThreshold, "dBZ");
85 parameters.link("distanceMin", this->distanceMin = distanceMin, "km");
86 parameters.link("refit", this->refit = refit, "true|false"); // [0.0...1.0]
87 // parameters.link("weightLower", this->weightLower = weightLower, "[0.0...1.0]");
88 // parameters.link("debugRow", this->debugRow = debugRow, "index");
89
90 UNIVERSAL = true;
92 }
93
94
95 double smoothnessThreshold;
96 double distanceMin;
97 //double sampleContent;
98 //double weightLower;
99 bool refit;
100 //double derivativeDifferenceMax;
101
128 //double maxCurvature;
129
130
132
134
139 static inline
140 double modelledEmitter(double dBZ0, double distance){
141 return dBZ0 + distance*(0.016/1000.0) + 20.0*log10(distance);
142 };
143
144protected:
145
146 virtual
148 //void filterImage(const PolarODIM &odimIn, const Image &src, Image &dst) const;
149
150 /*
151 static
152 void fitCurve(const std::vector<double> &src, const std::vector<double> &weight, std::vector<double> &coeff);
153
154 virtual
155 void filterImageOLD(const PolarODIM &odimIn, const Image &src, Image &dst) const;
156 */
157
159 inline
160 static
161 double derivativeDBZ(const PolarODIM &odimIn, const Image &src, int i, int j, int span = 10){
162 int iLower = std::max(i-span, 0);
163 double zLower = src.get<double>(iLower,j);
164 if (odimIn.isValue(zLower)){
165 int iUpper = std::min(i+span, static_cast<int>(src.getWidth())-1);
166 double zUpper = src.get<double>(iUpper,j);
167 if (odimIn.isValue(zUpper)){
168 return (zUpper - zLower)/(odimIn.rscale*static_cast<double>(iUpper-iLower));
169 }
170 }
171 return std::numeric_limits<double>::max();
172 }
173
176 inline
177 static
178 double derivativeDBZ_Modelled(double yModelBase, double range, double rangeDifference){
180 }
181
182
183};
184
185}
186
187#endif // Jamming2_OP_H_
188
189// Rack
map_t parameters
Parameters (name -> linked variable), typically linked to member variables of the derived class.
Definition BeanLike.h:313
T get(size_t i) const
Gets the intensity at location i. See address().
Definition ImageFrame.h:263
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition Image.h:183
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
bool REQUIRE_STANDARD_DATA
Set to true if operator expects fixed background intensities instead of "nodata" defined by the Polar...
Definition DetectorOp.h:212
bool UNIVERSAL
If true, applies also to quantities str than the one used in detection. The detection and the accumul...
Definition DetectorOp.h:177
A detector for widespread electromagnetic interference.
Definition JammingOp.h:64
static double modelledEmitter(double dBZ0, double distance)
Model for radar amplification of an external emitter.
Definition JammingOp.h:140
static double derivativeDBZ(const PolarODIM &odimIn, const Image &src, int i, int j, int span=10)
Returns the beam-oriented derivative of the dBZ field. In case of no-data, returns std::numeric_limit...
Definition JammingOp.h:161
int debugRow
Definition JammingOp.h:131
virtual void runDetector(const PlainData< PolarSrc > &srcData, PlainData< PolarDst > &dstProb) const
Process as sweep (data in one elevation angle). Disabled; see runDetection() above for the equivalent...
Definition JammingOp.cpp:53
JammingOp(double smoothnessThreshold=5.0, double distanceMin=80.0, double refit=true, int debugRow=-1)
Definition JammingOp.h:80
Metadata structure for single-radar data (polar scans, volumes and products).
Definition PolarODIM.h:45
Namespace for images and image processing tools.
Definition AccumulationArray.cpp:45
Definition AltitudeOp.cpp:42