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 {
140 double fromValue = 0.0;
141 double toValue = 0.0;
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 {
176 double threshold = 0.5;
177 double replace = 0.0;
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 {
218 double threshold = 0.5;
219 double replace = 0.0;
220 double replaceHigh = 1.0;
258 this->getParameters().link(
"gamma", this->gamma = gamma,
"0.0...");
262 this->getParameters().link(
"gamma", this->gamma = ftor.gamma,
"0.0..");
268 double operator()(
double s)
const {
269 return this->
scale * pow(s, 1.0/gamma);
295 this->getParameters().link(
"scale", this->
scale);
296 this->getParameters().link(
"bias", this->
bias);
300 double operator()(
double s1,
double s2)
const {
320 this->getParameters().link(
"scale", this->
scale);
321 this->getParameters().link(
"bias", this->
bias);
325 double operator()(
double s1,
double s2)
const {
358 this->getParameters().link(
"scale", this->
scale);
359 this->getParameters().link(
"bias", this->
bias);
364 double operator()(
double s1,
double s2)
const {
382 this->getParameters().link(
"scale", this->
scale);
383 this->getParameters().link(
"bias", this->
bias);
388 double operator()(
double s1,
double s2)
const {
427 this->getParameters().link(
"coeff", this->coeff);
428 this->getParameters().link(
"scale", this->
scale);
429 this->getParameters().link(
"bias", this->
bias);
435 parameters.
copyStruct(ftor.parameters, ftor, *
this);
441 double operator()(
double s1,
double s2)
const {
447 void updateScale()
const {
449 this->scaleFinal2 = this->
scale*(1.0-this->coeff);
481 double operator()(
double s1,
double s2)
const {
482 return this->
scale * std::max(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
506 double operator()(
double s1,
double s2)
const {
507 return this->
scale * std::min(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
Adds a intensity values .
Definition FunctorPack.h:290
Thresholds intensity values.
Definition FunctorPack.h:189
Divides image by another image.
Definition FunctorPack.h:377
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
Gamma correction. Intensity is mapped as f' = f^(gamma)
Definition FunctorPack.h:253
Definition FunctorPack.h:472
Minimum intensity. Prescaled input.
Definition FunctorPack.h:497
Blends an image to another with given proportion.
Definition FunctorPack.h:422
Multiplies two images, with optional post scaling and offset.
Definition FunctorPack.h:353
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:315
Thresholds intensity values.
Definition FunctorPack.h:154
Definition DataSelector.cpp:1277