84 void updateScale()
const {
128 double operator()(
double x)
const {
166 this->parameters.link(
"position", this->range.tuple());
167 this->parameters.link(
"scale", this->
scale);
168 this->parameters.link(
"bias", this->
bias);
173 this->parameters.
copyStruct(f.getParameters(), f, *
this);
180 void set(
double rangeMin,
double rangeMax,
double scale=1.0,
double bias=0.0){
181 this->range.min = rangeMin;
182 this->range.max = rangeMax;
202 this->
INVERSE = (range.min > range.max);
205 rangeFinal.min = range.min;
206 rangeFinal.max = range.max;
207 span = range.max - range.min;
211 rangeFinal.min = range.max;
212 rangeFinal.max = range.min;
213 span = range.min - range.max;
224 double operator()(
double x)
const {
226 if (x <= rangeFinal.min)
228 else if (x >= rangeFinal.max)
231 return this->
biasFinal + this->scaleFinal*(x-rangeFinal.min) / span;
267 this->parameters.link(
"position", this->
range.tuple());
268 this->parameters.link(
"peakPos", this->
peakPos);
269 this->parameters.link(
"scale", this->
scale);
270 this->parameters.link(
"bias", this->
bias);
277 this->parameters.link(
"position", this->range.tuple());
278 this->parameters.link(
"peakPos", this->
peakPos);
279 this->parameters.link(
"scale", this->
scale);
280 this->parameters.link(
"bias", this->
bias);
287 this->parameters.
copyStruct(f.getParameters(), f, *
this);
296 void set(
double startPos,
double endPos,
double peakPos=std::numeric_limits<double>::min,
double scale=1.0,
double bias=0.0){
298 this->range.set(startPos, endPos);
342 double operator()(
double x)
const {
349 else if (x > span.min)
399 this->parameters.link(
"location", this->location = location);
400 this->parameters.link(
"width", this->width = width);
401 this->parameters.link(
"scale", this->
scale =
scale);
402 this->parameters.link(
"bias", this->
bias =
bias);
408 this->parameters.
copyStruct(f.getParameters(), f, *
this);
415 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0){
416 this->location = location;
424 this->location = 0.5 * (range[0] + range[1]);
425 this->width = (range[1] - range[0]);
433 this->widthInv = 1.0/width;
440 double operator()(
double x)
const {
442 x = widthInv * (x - this->location);
447 double location = 0.0;
454 double widthInv = 1.0;
476 this->parameters.link(
"location", this->location = location);
477 this->parameters.link(
"width", this->width = width);
478 this->parameters.link(
"scale", this->
scale =
scale);
479 this->parameters.link(
"bias", this->
bias =
bias);
484 this->parameters.
copyStruct(f.getParameters(), f, *
this);
492 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
493 this->location = location;
502 this->location = 0.5 * (range[0] + range[1]);
503 this->width = (range[1] - range[0]);
510 double operator()(
double x)
const {
511 x = steepness * (x - location);
519 steepness = sqrt(sqrt(2.0)-1.0)/width;
524 double location = 0.0;
530 double steepness = 1.0;
547 this->parameters.link(
"location", this->location = location);
548 this->parameters.link(
"width", this->width = width);
549 this->parameters.link(
"scale", this->
scale =
scale);
550 this->parameters.link(
"bias", this->
bias =
bias);
556 this->parameters.
copyStruct(f.getParameters(), f, *
this);
565 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
566 this->location = location;
575 double operator()(
double x)
const {
576 x = x - this->location;
585 double location = 0.0;
592 void updateScale()
const {
599 this->absWidth = width;
604 this->absWidth = -width;
627 this->parameters.link(
"location", this->location = location);
628 this->parameters.link(
"width", this->width = width);
629 this->parameters.link(
"scale", this->
scale =
scale);
630 this->parameters.link(
"bias", this->
bias =
bias);
635 this->parameters.
copyStruct(f.getParameters(), f, *
this);
642 void set(
double location=0.0,
double width=1.0,
double scale=1.0,
double bias=0.0){
643 this->location = location;
653 widthFinal = fabs(width);
660 double operator()(
double x)
const {
661 x = x - this->location;
670 double location = 0.0;
677 void updateScale()
const {
710 this->parameters.link(
"location", this->location = location);
711 this->parameters.link(
"width", this->width = width);
712 this->parameters.link(
"scale", this->
scale =
scale);
713 this->parameters.link(
"bias", this->
bias =
bias);
718 this->parameters.
copyStruct(f.getParameters(), f, *
this);
726 void set(
double location = 0.0,
double width = 1.0,
double scale=1.0,
double bias=0.0) {
727 this->location = location;
736 steepness = 1.0/fabs(width);
742 double operator()(
double x)
const {
743 x = steepness * (x - location);
749 double location = 0.0;
756 void updateScale()
const {
758 if (this->width >= 0.0){
769 double steepness = 1.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:78
A smooth symmetric peak function that resembles the Gaussian bell curve. Diminishes quicker than Fuzz...
Definition Fuzzy.h:470
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:518
void set(const UniTuple< double, 2 > &range, double scale=1.0, double bias=0.0)
Set peak to a given half-width range.
Definition Fuzzy.h:501
A smooth symmetric peak function that resembles the Gaussian bell curve.
Definition Fuzzy.h:393
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:432
Identity function - returns the input value.
Definition Fuzzy.h:117
A smooth step function, by default from -1.0 to +1.0.
Definition Fuzzy.h:541
A basic, linear transition from 0 to scale between (start) and (end) .
Definition Fuzzy.h:154
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:198
FuzzyStep(T startPos=-1.0, T endPos=1.0, double scale=1.0, double bias=0.0)
Constructor.
Definition Fuzzy.h:165
A smooth step function between 0.0 and 1.0. Increasing (decreasing) with positive (negative) width....
Definition Fuzzy.h:620
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:650
A basic triangular peak function with linear around the peak.
Definition Fuzzy.h:262
void set(double startPos, double endPos, double peakPos=std::numeric_limits< double >::min, double scale=1.0, double bias=0.0)
Sets the parameters of the membership function.
Definition Fuzzy.h:296
double peakPos
Peak position.
Definition Fuzzy.h:361
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:322
drain::Range< double > range
Start and end position.
Definition Fuzzy.h:357
A function taking shape of two peaks, with a zero in the middle .
Definition Fuzzy.h:703
virtual void updateBean() const override
Called after setParameters()
Definition Fuzzy.h:734
FuzzyTwinPeaks(double location=0.0, double width=1.0, double scale=1.0, double bias=0.0)
Definition Fuzzy.h:707
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Logger & debug2(const TT &... args)
Debug information.
Definition Log.h:676
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:407
Tuple of N elements of type T.
Definition UniTuple.h:65
Definition DataSelector.cpp:1277