ClutterOp.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 #ifndef ClutterMapOP_H_
32 #define ClutterMapOP_H_
33 
34 #include <andre/DetectorOp.h>
35 #include "data/Data.h"
36 #include "data/DataSelector.h"
37 #include <hi5/Hi5.h>
38 #include "drain/util/ReferenceMap.h"
39 #include <string>
40 
41 using namespace drain::image;
42 
43 namespace rack {
44 
46 
55 class ClutterOp: public DetectorOp {
56 
57 public:
58 
60 
68  inline
69  ClutterOp(double decay=0.5, double gamma=1.0, const std::string & quantity ="CLUTTER", const std::string & file = "cluttermaps/cluttermap-${NOD}-${quantity}.h5") :
70  DetectorOp(__FUNCTION__, "Reads a ground clutter map and scales it to sweeps.", "nonmet.clutter.ground"){ // Optional postprocessing: morphological closing.
71  // dataSelector.path = ". */da ta[0-9]+/?$";
72  REQUIRE_STANDARD_DATA = false;
73  UNIVERSAL = true;
74 
75  dataSelector.setQuantities(""); // or FREQ?
76  dataSelector.setMaxCount(1);
77 
78  parameters.link("decay", this->decay = decay, "per 1000m");
79  parameters.link("gamma", this->gamma = gamma, "brightness");
80  parameters.link("quantity", this->quantity = quantity, "CLUTTER|OBSTACLE|...");
81  parameters.link("file", this->file = file, "path syntax");
82  // parameters.link("pathSyntax", this->pathSyntax = pathSyntax);
83  // parameters.link("filename", this->filename, filename);
84  };
85 
86 
87  double decay;
88  double gamma;
89  std::string quantity;
90  std::string file;
91 
93  void setClutterMap(const std::string & filename) const;
94 
95  // Dev trial
96  const Hi5Tree & getClutterMap(const PolarODIM & odim) const;
97 
98 
99  virtual
100  void runDetection(const DataSet<PolarSrc> & src, PlainData<PolarDst> & dst, DataSet<PolarDst> & aux) const;
101 
102 protected:
103 
104  mutable Hi5Tree clutterMap;
105 
106 
107 
108 
109 
110 };
111 
112 
113 }
114 
115 #endif
116 
117 // Rack
Based on pre-computed clutter map, scales the clutter probability for desired sweeps.
Definition: ClutterOp.h:55
ClutterOp(double decay=0.5, double gamma=1.0, const std::string &quantity="CLUTTER", const std::string &file="cluttermaps/cluttermap-${NOD}-${quantity}.h5")
Default constructor.
Definition: ClutterOp.h:69
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition: Data.h:1213
Base class for anomaly detectors.
Definition: DetectorOp.h:49
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
Namespace for images and image processing tools.
Definition: AccumulationArray.cpp:45
Definition: DataSelector.cpp:44