Loading...
Searching...
No Matches
AccumulationArray.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 ACCUMULATIONARRAY_H_
32#define ACCUMULATIONARRAY_H_
33
34#include <math.h>
35
36
37//#include "drain/util/Data.h"
38//#include "drain/util/Variable.h"
39//#include "drain/util/DataScaling.h"
40
41#include "ImageT.h"
42//#include "Coordinates.h"
43#include "CoordinateHandler.h"
44
45//#include "AccumulationRules.h"
46
47
48
49// TODO: image/
53namespace drain
54{
55
56namespace image
57{
58
59
60
61class AccumulationMethod;
62/*
63class AverageRule;
64class WeightedAverageRule;
65*/
66
67
68
70
108{
109public:
110
111 friend class AccumulationMethod;
112
114 AccumulationArray(size_t width = 0, size_t height = 0){ // : debug(false) {
115 setGeometry(width, height);
116 };
117
118 inline
119 AccumulationArray(const AccumulationArray & accArray){ // : debug(false) {
120 setGeometry(accArray.getGeometry());
121 };
122
125
127 virtual
128 void setGeometry(size_t width, size_t height);
129
131 inline
132 void setGeometry(const AreaGeometry & geometry){
133 setGeometry(geometry.getWidth(), geometry.getHeight());
134 }
135
136
137 inline
138 const AreaGeometry & getGeometry() const {
139 return geometry;
140 }
141
143 void clear();
144
146 inline
147 void reset(){
148 setGeometry(0, 0);
149 };
150
151
153 inline
154 unsigned int getWidth() const { return geometry.width; };
155
157 inline
158 unsigned int getHeight() const { return geometry.height; };
159
160 inline
161 const CoordinateHandler2D & getCoordinateHandler() const {
162 return coordinateHandler;
163 };
164
165 //bool debug;
166
167 inline
168 size_t address(const size_t &i, const size_t &j) const {
169 return data.address(i,j);
170 };
171
172//protected:
173
176
179
182
184 // actual data \f$ sum w_i^r x_i^{2p} \f$
186
187
188
189protected:
190
191 AreaGeometry geometry;
192
193 CoordinateHandler2D coordinateHandler;
194
195};
196
197std::ostream & operator<<(std::ostream &ostr, const AccumulationArray &cumulator);
198
199
200}
201
202}
203
204#endif /* Cumulator_H_ */
205
206// Drain
General-purpose image compositing.
Definition AccumulationArray.h:108
AccumulationArray(size_t width=0, size_t height=0)
Default constructor. The channels are DATA, COUNT, WEIGHT, WEIGHT2.
Definition AccumulationArray.h:114
ImageT< double > data
Accumulation array for actual data: , or generally .
Definition AccumulationArray.h:175
unsigned int getHeight() const
Returns the height of the accumulation array.
Definition AccumulationArray.h:158
virtual ~AccumulationArray()
Destructor.
Definition AccumulationArray.h:124
virtual void setGeometry(size_t width, size_t height)
Changes the geometry of all the layers.
Definition AccumulationArray.cpp:47
ImageT< double > data2
Accumulation array for auxiliary data; typically for std.deviation or difference (in Overwrite)
Definition AccumulationArray.h:185
void setGeometry(const AreaGeometry &geometry)
Changes the geometry of all the layers.
Definition AccumulationArray.h:132
ImageT< unsigned int > count
Accumulation array ( in )
Definition AccumulationArray.h:181
unsigned int getWidth() const
Returns the width of the accumulation array.
Definition AccumulationArray.h:154
void clear()
Resets the accumulation array values to undetectValue. Does not change the geometry.
Definition AccumulationArray.cpp:63
void reset()
Collapses the accumulation geometries to zero area.
Definition AccumulationArray.h:147
ImageT< double > weight
Accumulation array for weights ( )
Definition AccumulationArray.h:178
Function for accumulating data: maximum, average, weighted average etc.
Definition AccumulationMethods.h:66
Definition CoordinateHandler.h:74
size_t address(size_t i) const
Computes the index location from image coordinates. Does not involve bit resolution.
Definition ImageFrame.h:143
A template class for images with static storage type.
Definition ImageT.h:61
Definition DataSelector.cpp:1277