31 #ifndef ImpulseAvgOp_H
32 #define ImpulseAvgOp_H
34 #include <drain/image/CoordinatePolicy.h>
35 #include <drain/UniTuple.h>
40 #include "drain/image/FilePng.h"
44 #include "ImpulseResponseOp.h"
59 Decay2(
double decay = 1.0) : forward(this->next()), backward(this->next()) {
75 Decay4(T decay=0.5) : horz(this->tuple(), 0), vert(this->tuple(), 2) {
80 Decay4(
const Decay4 & r) : horz(this->tuple(), 0), vert(this->tuple(), 2){
85 this->set(decay.tuple());
102 this->parameters.link(
"decay", decays.tuple());
109 BeanLike(__FUNCTION__,
"Infinite-impulse response type spreading"), decays(0.75){
110 this->parameters.link(
"decay", decays.tuple());
157 decays = conf.decays;
168 void addLeft(
int i,
double value,
double weight);
172 void addRight(
int i,
double value,
double weight);
176 void addDown(
int i,
double value,
double weight);
180 void addUp(
int i,
double value,
double weight);
202 inline void set(
double value,
double weight){
204 this->weight = weight;
214 void mix(entry & prev,
const entry & e,
double decay){
216 double w1 = decay*e.weight;
217 double w2 = (1.0-decay);
220 prev.x =(w1*e.x + w2*prev.x) / (w1 + w2);
224 prev.weight = w1 + w2*prev.weight;
228 typedef std::pair<entry,entry> entryPair;
229 typedef std::vector<entryPair> container;
Something which has a name, a description and possibly some parameters of varying type.
Definition: BeanLike.h:60
void fill(S i)
Set all the elements to i.
Definition: TupleBase.h:272
Tuple of N elements of type T.
Definition: UniTuple.h:65
Linear scaling and physical range for image intensities.
Definition: ValueScaling.h:64
Image with static geometry.
Definition: ImageChannel.h:60
Definition: ImpulseAvgOp.h:52
Averaging operator. A simple example implementation of ImpulseBucket.
Definition: ImpulseAvgOp.h:140
virtual void addUp(int i, double value, double weight)
Accumulate encoded value.
Definition: ImpulseAvgOp.cpp:91
virtual void init(const Channel &src, bool horizontal)
Adapt to input geometry, type, and scaling.
Definition: ImpulseAvgOp.cpp:46
virtual double getWeight(int i)
Return weight at position i.
Definition: ImpulseAvgOp.cpp:98
virtual void addRight(int i, double value, double weight)
Accumulate encoded value.
Definition: ImpulseAvgOp.cpp:79
virtual double get(int i)
Return natural (not encoded) value at position i.
Definition: ImpulseAvgOp.cpp:103
virtual void addLeft(int i, double value, double weight)
Accumulate encoded value.
Definition: ImpulseAvgOp.cpp:73
virtual void addDown(int i, double value, double weight)
Accumulate encoded value.
Definition: ImpulseAvgOp.cpp:85
virtual void reset()
Clear statistics before traversing each row or column.
Definition: ImpulseAvgOp.cpp:60
Definition: ImpulseResponseOp.h:54
Definition: DataSelector.cpp:1277
Definition: ImpulseAvgOp.h:70
Definition: ImpulseAvgOp.h:95