31 #ifndef FUNCTOR_PACK_H_
32 #define FUNCTOR_PACK_H_
62 this->getParameters().link(
"scale", this->
scale);
63 this->getParameters().link(
"bias", this->
bias);
68 this->parameters.
copyStruct(ftor.getParameters(), ftor, *
this);
74 double operator()(
double s)
const {
80 ScalingFunctor(
const std::string & name,
const std::string & description,
double scale = 1.0,
double bias = 0.0) :
121 RemappingFunctor(
double fromValue = 0.0,
double toValue = 0.0) :
UnaryFunctor(__FUNCTION__,
"Rescales intensities linerarly") , fromValue(fromValue), toValue(toValue) {
122 this->getParameters().link(
"fromValue", this->fromValue = fromValue);
123 this->getParameters().link(
"toValue", this->toValue = toValue);
127 parameters.
copyStruct(ftor.parameters, ftor, *
this);
132 double operator()(
double s)
const {
158 ThresholdFunctor(
double threshold = 0.5,
double replace = 0.0) :
UnaryFunctor(__FUNCTION__,
"Resets values lower than a threshold") , threshold(threshold), replace(replace) {
159 this->getParameters().link(
"threshold", this->threshold = threshold);
160 this->getParameters().link(
"replace", this->replace = replace);
164 parameters.
copyStruct(ftor.parameters, ftor, *
this);
169 double operator()(
double s)
const {
199 BinaryThresholdFunctor(
double threshold = 0.5,
double replace = 0.0,
double replaceHigh = 1.0) :
UnaryFunctor(__FUNCTION__,
"Resets values lower and higher than a threshold") {
201 this->getParameters().link(
"threshold", this->threshold = threshold);
202 this->getParameters().link(
"replace", this->replace = replace);
203 this->getParameters().link(
"replaceHigh", this->replaceHigh = replaceHigh);
207 parameters.
copyStruct(ftor.parameters, ftor, *
this);
211 double operator()(
double s)
const {
243 this->getParameters().link(
"scale", this->
scale);
244 this->getParameters().link(
"bias", this->
bias);
248 double operator()(
double s1,
double s2)
const {
268 this->getParameters().link(
"scale", this->
scale);
269 this->getParameters().link(
"bias", this->
bias);
273 double operator()(
double s1,
double s2)
const {
306 this->getParameters().link(
"scale", this->
scale);
307 this->getParameters().link(
"bias", this->
bias);
312 double operator()(
double s1,
double s2)
const {
330 this->getParameters().link(
"scale", this->
scale);
331 this->getParameters().link(
"bias", this->
bias);
336 double operator()(
double s1,
double s2)
const {
375 this->getParameters().link(
"coeff", this->coeff);
376 this->getParameters().link(
"scale", this->
scale);
377 this->getParameters().link(
"bias", this->
bias);
383 parameters.
copyStruct(ftor.parameters, ftor, *
this);
389 double operator()(
double s1,
double s2)
const {
395 void updateScale()
const {
397 this->scaleFinal2 = this->
scale*(1.0-this->coeff);
429 double operator()(
double s1,
double s2)
const {
430 return this->
scale * std::max(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
454 double operator()(
double s1,
double s2)
const {
455 return this->
scale * std::min(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
Adds a intensity values .
Definition: FunctorPack.h:238
Definition: Functor.h:135
Thresholds intensity values.
Definition: FunctorPack.h:189
Divides image by another image.
Definition: FunctorPack.h:325
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
Definition: FunctorPack.h:420
Minimum intensity. Prescaled input.
Definition: FunctorPack.h:445
Blends an image to another with given proportion.
Definition: FunctorPack.h:370
Multiplies two images, with optional post scaling and offset.
Definition: FunctorPack.h:301
Inverts intensities: f' = f_max - f.
Definition: FunctorPack.h:97
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
Maps a single intensity value to another value.
Definition: FunctorPack.h:117
Rescales intensities linearly: f' = scale*f + offset.
Definition: FunctorPack.h:57
Subtracts image from another image.
Definition: FunctorPack.h:263
Thresholds intensity values.
Definition: FunctorPack.h:154
Definition: DataSelector.cpp:1277
Definition: Functor.h:116