31 #ifndef SLIDINGWINDOWHISTOGRAM_H_
32 #define SLIDINGWINDOWHISTOGRAM_H_
36 #include "SlidingWindowOp.h"
38 #include "drain/util/Histogram.h"
50 std::string valueFunc;
66 template <
class R = WindowCore>
99 histogram.
setSize(this->conf.bins);
102 histogram.
setRange(this->src.getConf().template getTypeMin<int>(), this->src.getConf().template getTypeMax<int>());
104 if (!this->conf.valueFunc.empty())
105 histogram.setValueFunc(this->conf.valueFunc.at(0));
109 mout.
warn(
"histogram=", histogram,
" ");
110 mout.debug3(this->coordinateHandler);
117 drain::Logger mout(getImgLog(),
"SlidingWindowHistogramWeighted", __FUNCTION__);
130 this->coordinateHandler.set(this->src.getGeometry(), this->src.getCoordinatePolicy());
136 if (this->coordinateHandler.
validate(p))
137 histogram.decrement(this->src.template get<int>(p));
145 if (this->coordinateHandler.
validate(p))
146 histogram.increment(this->src.template get<int>(p));
151 this->dst.
put(this->
location, histogram.getValue());
186 this->dst.
put(this->
location, this->histogram.getValue());
188 this->dstWeight.put(this->
location, this->histogram.
getMean<
double>());
201 if (this->coordinateHandler.
validate(p))
202 this->histogram.increment(this->src.
get<
int>(p), this->srcWeight.get<
int>(p));
207 if (this->coordinateHandler.
validate(p))
208 this->histogram.decrement(this->src.
get<
int>(p), this->srcWeight.get<
int>(p));
240 "A pipeline implementation of window histogram; valueFunc=[asmdvNX] (avg,sum,median,stddev,variance,miN,maX)"){
241 parameters.link(
"valueFunc", this->conf.valueFunc = valueFunc,
"asmdvXN");
242 parameters.link(
"percentage", this->conf.percentage = percentage);
243 parameters.link(
"bins", this->conf.bins = bins);
Class for computing a histogram and some statistics: average, min, max, mean, std....
Definition: Histogram.h:61
void clearBins()
Does not change the size of the histogram.
Definition: Histogram.h:94
void setRange(double dataMin, double dataMax)
Set range of original (physical) values to be mapped on the limited number of bins....
Definition: Histogram.cpp:76
void setMedianPosition(double pos)
Set location of the median, if not in the middle (50%).
Definition: Histogram.h:177
T getMean() const
Unscaled mean.
Definition: Histogram.h:305
void setSampleCount(long int n)
Does not change the size of the histogram.
Definition: Histogram.h:113
void setSize(size_t s)
Sets the number of bins; the resolution of the histogram.
Definition: Histogram.cpp:62
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Logger & warn(const TT &... args)
Possible error, but execution can continue.
Definition: Log.h:426
bool validate(Point2D< int > &p) const
Handles the coordinate, returning true if the position is reversible.
Definition: CoordinateHandler.h:223
Definition: SlidingWindowHistogramOp.h:54
void put(size_t i, T x)
Sets the intensity in location i to x. See \address.
Definition: ImageFrame.h:192
T get(size_t i) const
Gets the intensity at location i. See address().
Definition: ImageFrame.h:254
Window histogram for computing [asmdvNX] = iAverage, sum, median, stddev, variance,...
Definition: SlidingWindowHistogramOp.h:235
Definition: SlidingWindowHistogramOp.h:173
virtual void write()
Write the result in the target image.
Definition: SlidingWindowHistogramOp.h:185
virtual void removePixel(Point2D< int > &p)
Removes a pixel from window statistics. Unvalidated location.
Definition: SlidingWindowHistogramOp.h:206
virtual void addPixel(Point2D< int > &p)
Adds a pixel to window statistics. Unvalidated location.
Definition: SlidingWindowHistogramOp.h:195
Base class for median and str histogram based statistics.
Definition: SlidingWindowHistogramOp.h:67
virtual void setImageLimits() const
Sets internal limits corresponding to image geometries. Typically using coordHandler.
Definition: SlidingWindowHistogramOp.h:129
virtual void write()
Write the result in the target image.
Definition: SlidingWindowHistogramOp.h:150
virtual void removePixel(Point2D< int > &p)
Removes a pixel from window statistics. Unvalidated location.
Definition: SlidingWindowHistogramOp.h:135
virtual void addPixel(Point2D< int > &p)
Adds a pixel to window statistics. Unvalidated location.
Definition: SlidingWindowHistogramOp.h:141
virtual void initialize()
Definition: SlidingWindowHistogramOp.h:91
virtual void clear()
Clears the applied statistics. Redefined in derived classes.
Definition: SlidingWindowHistogramOp.h:115
Template for operators applying pipeline-like sliding window.
Definition: SlidingWindowOp.h:59
Window implementation that uses incremental update of state.
Definition: SlidingWindow.h:50
Base class for configurations applied in image processing windows, e.g. for operators of type WindowO...
Definition: Window.h:56
Point2D< int > location
Current location of this window.
Definition: Window.h:520
void setLoopLimits()
Sets the actual traversal range inside the window. Sometimes applied dynamically by reset().
Definition: Window.h:608
size_t getArea()
Returns the nominal area in pixels.
Definition: Window.h:486
Definition: DataSelector.cpp:1277
Definition: SlidingWindowHistogramOp.h:46