31#ifndef FUNCTOR_PACK_H_
32#define FUNCTOR_PACK_H_
74 double operator()(
double s)
const {
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);
132 double operator()(
double s)
const {
140 double fromValue = 0.0;
141 double toValue = 0.0;
160 ThresholdFunctor(
double threshold = 0.5,
double replace = 0.0) :
UnaryFunctor(__FUNCTION__,
"Resets values lower than a threshold") , threshold(threshold), replace(replace) {
161 this->
getParameters().link(
"threshold", this->threshold = threshold);
162 this->
getParameters().link(
"replace", this->replace = replace);
171 double operator()(
double s)
const override {
178 double threshold = 0.5;
179 double replace = 0.0;
198 BinaryThresholdFunctor(
double threshold = 0.5,
double replaceLow = 0.0,
double replaceHigh = 1.0) :
UnaryFunctor(__FUNCTION__,
"Resets values lower and higher than a threshold") {
199 this->
getParameters().link(
"threshold", this->threshold.tuple(threshold,threshold),
"min[:max]").fillArray =
true;
200 this->
getParameters().link(
"replace", this->replace.tuple(replaceLow, replaceHigh),
"min[:max]");
208 double operator()(
double s)
const override {
209 if (s < threshold.min)
211 else if (s > threshold.max)
256 this->
getParameters().link(
"gamma", this->gamma = gamma,
"0.0...");
260 this->
getParameters().link(
"gamma", this->gamma = ftor.gamma,
"0.0..");
266 double operator()(
double s)
const {
267 return this->
scale * pow(s, 1.0/gamma);
297 double operator()(
double s1,
double s2)
const {
322 double operator()(
double s1,
double s2)
const {
361 double operator()(
double s1,
double s2)
const {
385 double operator()(
double s1,
double s2)
const {
438 double operator()(
double s1,
double s2)
const {
444 void updateScale()
const {
446 this->scaleFinal2 = this->
scale*(1.0-this->coeff);
455 double scaleFinal2 = 1.0;
480 double operator()(
double s1,
double s2)
const {
481 return this->
scale * std::max(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
505 double operator()(
double s1,
double s2)
const {
506 return this->
scale * std::min(
static_cast<double>(s1),
static_cast<double>(s2)) + this->
bias;
Adds a intensity values .
Definition FunctorPack.h:287
const std::string description
Brief, human-readable description of this bean.
Definition BeanLike.h:309
map_t parameters
Parameters (name -> linked variable), typically linked to member variables of the derived class.
Definition BeanLike.h:313
const map_t & getParameters() const
Returns the parameter map (const access).
Definition BeanLike.h:116
const std::string name
Name of this bean, typically also the name of the (derived) class.
Definition BeanLike.h:306
Thresholds intensity values.
Definition FunctorPack.h:194
Divides image by another image.
Definition FunctorPack.h:374
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:251
Definition FunctorPack.h:471
Minimum intensity. Prescaled input.
Definition FunctorPack.h:496
Blends an image to another with given proportion.
Definition FunctorPack.h:419
Multiplies two images, with optional post scaling and offset.
Definition FunctorPack.h:350
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:412
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:312
Thresholds intensity values.
Definition FunctorPack.h:156