36#if defined(BasicFunctors_RECURSES)
37#error Recursive header files inclusion detected in BasicFunctors.h
40#define BasicFunctors_RECURSES
42#if !defined BasicFunctors_h
44#define BasicFunctors_h
51#include "DGtal/io/Color.h"
52#include "DGtal/base/Common.h"
53#include "DGtal/base/BasicBoolFunctors.h"
68 {
return std::min(a,b); }
76 {
return std::max(a,b); }
92 template <
class T =
void>
150 template <
typename T =
void >
155 ->
decltype(std::round(value))
157 return std::round( value );
170 template <
typename T >
173 ->
decltype(std::round(value))
175 return std::round( value );
183 template <
typename T =
void >
188 ->
decltype(std::floor(value))
190 return std::floor( value );
203 template <
typename T >
206 ->
decltype(std::floor(value))
208 return std::floor( value );
216 template <
typename T =
void >
221 ->
decltype(std::ceil(value))
223 return std::ceil( value );
236 template <
typename T >
239 ->
decltype(std::ceil(value))
241 return std::ceil( value );
249 template <
typename T =
void >
254 ->
decltype(std::trunc(value))
256 return std::trunc( value );
269 template <
typename T >
272 ->
decltype(std::trunc(value))
274 return std::trunc( value );
294 template <
typename T >
309 template <
typename TValue>
329 template <
typename TInput>
352 template <
typename TQuantity,
typename TCell>
392 template <
typename TOutput >
400 template<
typename TInput>
404 return static_cast<TOutput
>(aInput);
416 template <
typename TFunctor1,
typename TFunctor2,
typename ReturnType >
466 template<
typename TInput>
472 return myF2->operator()(
myF1->operator()( aInput ) );
499template <
typename T,
bool isLower = true,
bool isEqual = true >
519 std::less_equal<Input> c;
543 std::greater<Input> c;
561 std::greater_equal<Input> c;
601 std::less_equal<Input> c;
620 template <
typename TPredicate1,
typename TPredicate2,
636 const TBinaryFunctor & boolFunctor )
755 template <
typename ReturnType>
768 template <
typename TPair>
784 template <
typename ReturnType>
797 template <
typename TPair>
814 template <
typename ReturnType>
827 template <
typename TPair>
842 template <
typename TPair>
859 template <
typename ReturnType>
872 template <
typename TPair>
887 template <
typename TPair>
904 template<
typename TInputType,
typename TOutputType>
923 Rescaling(
const TInputType &initMin,
const TInputType &initMax,
const TOutputType &newMin,
const TOutputType &newMax ) :
966 ASSERT((aVal <= 1) && (aVal>=0));
986#undef BasicFunctors_RECURSES
Aim: Define a new Functor from the composition of two other functors.
Composer(const TFunctor1 &aF1, const TFunctor2 &aF2)
Composer & operator=(const Composer &other)
ReturnType Value
Necessary for DistanceVisitor.
Composer(const Composer &other)
ReturnType operator()(const TInput &aInput) const
Aim: Define a simple functor that returns a constant quantity (0 by default).
Quantity operator()(const Cell &) const
ConstValueCell(const Quantity &aQuantity=0)
Aim: Define a simple functor that returns a constant value (0 by default).
Value operator()(const TInput &) const
ConstValue(const Value &aValue=0)
Aim: A small functor with an operator () that compares one value to an interval.
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
PredicateCombiner< Tlow, Tup, AndBoolFct2 > CombinedPredicate
bool operator()(const Input &aI) const
Thresholder< T, true, true > Tup
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
IntervalThresholder(const Input &low, const Input &up)
Thresholder< T, false, true > Tlow
predicates type
Aim: Define a simple unary functor that returns a reference on the first member of a pair in order to...
ReturnType & operator()(TPair &aPair) const
const ReturnType & operator()(const TPair &aPair) const
Aim: Define a simple functor that returns the first member of a pair.
ReturnType operator()(const TPair &aPair) const
Aim: Define a simple unary functor that returns a reference on the first member of a pair in order to...
ReturnType & operator()(TPair &aPair) const
const ReturnType & operator()(const TPair &aPair) const
Aim: Define a simple functor that returns the second member of a pair.
ReturnType operator()(const TPair &aPair) const
Aim: A small functor with an operator () that compares one value to a threshold value according to tw...
bool operator()(const Input &aI) const
Thresholder(const Input &aT=0)
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
boost::function2< bool, bool, bool > BoolFunctor2
DGtal is the top-level namespace which contains all DGtal functions and types.
T operator()(const T &x) const
Aim: Define a simple functor using the static cast operator.
TOutput operator()(const TInput &aInput) const
auto operator()(const T &value) const -> decltype(std::ceil(value))
Functor that rounds down.
auto operator()(const T &value) const -> decltype(std::floor(value))
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel....
double myCoef2
Temporary variable.
double mySigma
Sigma parameter.
double myCoef
Temporary variable.
GaussianKernel(const double aSigma)
double operator()(const double aVal) const
Aim: Define a simple default functor that just returns its argument.
T operator()(const T &aT) const
T operator()(const T &a, const T &b) const
T operator()(const T &a, const T &b) const
T operator()(const T &x, const T &y) const
T operator()(const T &x) const
MultiplicationByScalar(const T &aValue)
Aim: The predicate returns true when the given binary functor returns true for the two Predicates giv...
PredicateCombiner & operator=(const PredicateCombiner &other)
PredicateCombiner(const Predicate1 &pred1, const Predicate2 &pred2, const TBinaryFunctor &boolFunctor)
const TBinaryFunctor * myBoolFunctor
aliasing pointer to the binary functor.
PredicateCombiner(const PredicateCombiner &other)
const Predicate2 * myPred2
aliasing pointer to the right predicate.
const Predicate1 * myPred1
aliasing pointer to the left predicate.
bool operator()(const T &t) const
Aim: Functor allowing to rescale a value. Values of the initial scale [initMin,initMax] are rescaled ...
TOutputType operator()(const TInputType &anInitVal) const
Rescaling(const TInputType &initMin, const TInputType &initMax, const TOutputType &newMin, const TOutputType &newMax)
Functor that rounds to the nearest integer.
auto operator()(const T &value) const -> decltype(std::round(value))
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
Thresholder(const Input &aT=0)
bool operator()(const Input &aI) const
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
Thresholder(const Input &aT=0)
bool operator()(const Input &aI) const
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
bool operator()(const Input &aI) const
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
Thresholder(const Input &aT=0)
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< T >))
bool operator()(const Input &aI) const
Thresholder(const Input &aT=0)
BOOST_CONCEPT_ASSERT((boost::LessThanComparable< T >))
Functor that rounds towards zero.
auto operator()(const T &value) const -> decltype(std::trunc(value))
T operator()(const T &x) const
Go to http://www.sgi.com/tech/stl/EqualityComparable.html.
Go to http://www.sgi.com/tech/stl/LessThanComparable.html.