Loading...
Searching...
No Matches
PolarWindow.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_POLAR_WINDOW
32#define RACK_POLAR_WINDOW
33
34
35#include <sstream>
36
37#include <drain/image/GaussianWindow.h>
38
39#include "data/PolarODIM.h"
40
41
42namespace rack {
43
44class GaussianStripeVertPolarWeighted : public drain::image::GaussianStripeWeighted<false> { // true=horizontal, false=vertical
45
46public:
47
48 GaussianStripeVertPolarWeighted(double radius=1.0, int height = 0) : drain::image::GaussianStripeWeighted<false>(height, radius), normRange(10,0) {
49 this->resetAtEdges = true;
50 };
51
52
53 /*
54 virtual
55 bool reset(){
56
57 //std::cerr << __FUNCTION__ << this->location << '\n';
58 //drain::image::GaussianStripe::reset();
59 //this->fill();
60
61 // Consider: {NEAR,LINEAR,FAR}
62 if (location.x < normRange.min){
63 RANGE = -1;
64 }
65 else if (location.x > (normRange.min*this->jMax)){
66 RANGE = +1;
67 }
68 else {
69 RANGE = 0;
70 }
71 return true;
72 }
73 */
74
75
76 void update();
77
79 inline
80 void setRangeNorm(const PolarODIM & odim){
81 drain::Logger mout("SlidingRadarWindow", __FUNCTION__);
82 normRange.min = static_cast<double>(odim.area.height) / (2.0*M_PI);
83 //normRange.min = static_cast<double>(this->conf.odimSrc.rscale * this->conf.odimSrc.geometry.height) / (2.0*M_PI);
84 normRange.max = (normRange.min * this->conf.frame.height);
85 //mout.warn(rangeNorm , '-' , rangeNormEnd );
86 }
87
88
90 inline
92 return normRange.min;
93 }
94
95protected:
96
99
100};
101
102
103} // rack::
104
105
106#endif /* RACK_POLAR_WINDOW */
107
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Definition Range.h:52
Definition GaussianWindow.h:179
bool resetAtEdges
To avoid accumulated numerical errors esp. with floats, reset the statistics at row/cols ends....
Definition Window.h:529
Definition PolarWindow.h:44
void setRangeNorm(const PolarODIM &odim)
Set range (bin) index, at which aspect ratio of along-beam and cross-beam distances is unity.
Definition PolarWindow.h:80
void update()
At each location, this is called to calculate and store something in members.
Definition PolarWindow.cpp:38
int getRangeNorm()
Range index, at which aspect ratio of along-beam and cross-beam distances is unity.
Definition PolarWindow.h:91
drain::Range< int > normRange
Range of bin indices: min: aspect ratio of along-beam and cross-beam distances is unity.
Definition PolarWindow.h:98
Metadata structure for single-radar data (polar scans, volumes and products).
Definition PolarODIM.h:45
Definition DataSelector.cpp:44