34 #include <drain/Log.h>
84 void updateScale()
const {
144 this->parameters.link(
"position", this->range.tuple());
145 this->parameters.link(
"scale", this->
scale);
146 this->parameters.link(
"bias", this->
bias);
151 this->parameters.
copyStruct(f.getParameters(), f, *
this);
158 void set(
double rangeMin,
double rangeMax,
double scale=1.0,
double bias=0.0){
159 this->range.min = rangeMin;
160 this->range.max = rangeMax;
180 this->
INVERSE = (range.min > range.max);
183 finalRange.min = range.min;
184 finalRange.max = range.max;
185 span = range.max - range.min;
189 finalRange.min = range.max;
190 finalRange.max = range.min;
191 span = range.min - range.max;
202 double operator()(
double x)
const {
204 if (x <= finalRange.min)
206 else if (x >= finalRange.max)
209 return this->
biasFinal + this->scaleFinal*(x-finalRange.min) / span;
245 this->parameters.link(
"position", this->
range.tuple());
246 this->parameters.link(
"peakPos", this->
peakPos);
247 this->parameters.link(
"scale", this->
scale);
248 this->parameters.link(
"bias", this->
bias);
255 this->parameters.link(
"position", this->range.tuple());
256 this->parameters.link(
"peakPos", this->
peakPos);
257 this->parameters.link(
"scale", this->
scale);
258 this->parameters.link(
"bias", this->
bias);
265 this->parameters.
copyStruct(f.getParameters(), f, *
this);
276 this->range.set(startPos, endPos);
312 double operator()(
double x)
const {
319 else if (x > span.min)
369 this->parameters.link(
"location", this->location = location);
370 this->parameters.link(
"width", this->width = width);
371 this->parameters.link(
"scale", this->
scale =
scale);
372 this->parameters.link(
"bias", this->
bias =
bias);
378 this->parameters.
copyStruct(f.getParameters(), f, *
this);
385 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0){
386 this->location = location;
395 this->widthInv = 1.0/width;
402 double operator()(
double x)
const {
404 x = widthInv * (x - this->location);
438 this->parameters.link(
"location", this->location = location);
439 this->parameters.link(
"width", this->width = width);
440 this->parameters.link(
"scale", this->
scale =
scale);
441 this->parameters.link(
"bias", this->
bias =
bias);
446 this->parameters.
copyStruct(f.getParameters(), f, *
this);
454 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
455 this->location = location;
465 double operator()(
double x)
const {
466 x = steepness * (x - location);
475 steepness = sqrt(sqrt(2.0)-1.0)/width;
503 this->parameters.link(
"location", this->location = location);
504 this->parameters.link(
"width", this->width = width);
505 this->parameters.link(
"scale", this->
scale =
scale);
506 this->parameters.link(
"bias", this->
bias =
bias);
512 this->parameters.
copyStruct(f.getParameters(), f, *
this);
521 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
522 this->location = location;
531 double operator()(
double x)
const {
532 x = x - this->location;
548 void updateScale()
const {
555 this->absWidth = width;
560 this->absWidth = -width;
583 this->parameters.link(
"location", this->location = location);
584 this->parameters.link(
"width", this->width = width);
585 this->parameters.link(
"scale", this->
scale =
scale);
586 this->parameters.link(
"bias", this->
bias =
bias);
591 this->parameters.
copyStruct(f.getParameters(), f, *
this);
598 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
599 this->location = location;
609 widthFinal = fabs(width);
617 double operator()(
double x)
const {
618 x = x - this->location;
634 void updateScale()
const {
667 this->parameters.link(
"location", this->location = location);
668 this->parameters.link(
"width", this->width = width);
669 this->parameters.link(
"scale", this->
scale =
scale);
670 this->parameters.link(
"bias", this->
bias =
bias);
675 this->parameters.
copyStruct(f.getParameters(), f, *
this);
683 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
684 this->location = location;
693 steepness = 1.0/fabs(width);
699 double operator()(
double x)
const {
700 x = steepness * (x - location);
713 void updateScale()
const {
715 if (this->width >= 0.0){
double scale
Relative scale, typically 1. Optional.
Definition: Functor.h:99
double scaleFinal
Scaling factor after encodings of src and dst images are known.
Definition: Functor.h:106
double bias
"Relative" bias, typically 0. Optional.
Definition: Functor.h:102
virtual void updateBean() const override
Called after setParameters()
Definition: Functor.h:65
double biasFinal
Scaling factor after encodings of src and dst images are known.
Definition: Functor.h:110
A base class for fuzzy functions; also an unary functor.
Definition: Fuzzy.h:55
bool INVERSE
Updates internal variables. Should be called after modifying public members.
Definition: Fuzzy.h:67
A smooth symmetric peak function that resembles the Gaussian bell curve. Diminishes quicker than Fuzz...
Definition: Fuzzy.h:432
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:474
A smooth symmetric peak function that resembles the Gaussian bell curve.
Definition: Fuzzy.h:363
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:394
A smooth step function, by default from -1.0 to +1.0.
Definition: Fuzzy.h:497
A basic, linear transition from 0 to scale between (start) and (end) .
Definition: Fuzzy.h:132
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:176
FuzzyStep(T startPos=-1.0, T endPos=1.0, double scale=1.0, double bias=0.0)
Constructor.
Definition: Fuzzy.h:143
A smooth step function between 0.0 and 1.0. Increasing (decreasing) with positive (negative) width....
Definition: Fuzzy.h:576
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:606
A basic triangular peak function with linear around the peak.
Definition: Fuzzy.h:240
double peakPos
Peak position.
Definition: Fuzzy.h:331
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:292
void set(double startPos, double endPos, double peakPos=0.0, double scale=1.0, double bias=0.0)
Sets the parameters of the membership function.
Definition: Fuzzy.h:274
drain::Range< double > range
Start and end position.
Definition: Fuzzy.h:324
A function taking shape of two peaks, with a zero in the middle .
Definition: Fuzzy.h:660
virtual void updateBean() const override
Called after setParameters()
Definition: Fuzzy.h:691
FuzzyTwinPeaks(double location=0.0, double width=1.0, double scale=1.0, double bias=0.0)
Definition: Fuzzy.h:664
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Logger & debug2(const TT &... args)
Debug information.
Definition: Log.h:686
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition: ReferenceMap.h:399
Definition: DataSelector.cpp:1277
Definition: Functor.h:116