|
DGtal 2.0.0
|
Transform a point-dependent (and possibly domain-dependent) functor into a constant image. More...
#include <DGtal/images/ConstImageFunctorHolder.h>
Data Structures | |
| class | ConstRange |
| Constant range on a ConstImageFunctorHolder. More... | |
Public Types | |
| using | Self = ConstImageFunctorHolder<TDomain, TValue, TFunctor> |
| using | Domain = TDomain |
| using | Point = typename Domain::Point |
| using | Vector = typename Domain::Vector |
| using | Integer = typename Domain::Integer |
| using | Size = typename Domain::Size |
| using | Dimension = typename Domain::Dimension |
| using | Vertex = Point |
| using | Value = TValue |
| using | Functor = TFunctor |
| using | ConstIterator = boost::transform_iterator< std::reference_wrapper<const Self>, typename Domain::ConstIterator > |
| using | ConstReverseIterator = boost::reverse_iterator< ConstIterator > |
Public Member Functions | |
| BOOST_STATIC_CONSTANT (Dimension, dimension=Domain::Space::dimension) | |
| template<class TGivenFunctor> | |
| ConstImageFunctorHolder (Domain const &aDomain, TGivenFunctor &&aFunctor) | |
| Constructor. | |
| Domain const & | domain () const |
| Returns the associated domain. | |
| template<typename TPoint> | |
| auto | operator() (TPoint const &aPoint) const -> decltype(myFunctor(aPoint)) |
| Evaluates the functor at the given point. | |
| template<typename TPoint> | |
| auto | operator() (TPoint const &aPoint) const -> decltype(myFunctor(aPoint, myDomain)) |
| ConstRange | constRange () const |
| Returns a constant range over this image. | |
| void | selfDisplay (std::ostream &out) const |
| Writes/Displays the object on an output stream. | |
| constexpr bool | isValid () const |
| Checks the validity/consistency of the object. | |
Private Member Functions | |
| BOOST_CONCEPT_ASSERT ((DGtal::concepts::CDomain< TDomain >)) | |
Private Attributes | |
| Domain | myDomain |
| The image domain. | |
| Functor | myFunctor |
| The functor that generates the image. | |
Transform a point-dependent (and possibly domain-dependent) functor into a constant image.
| TDomain | Domain type. |
| TValue | Value type returned by the functor. |
| TFunctor | Type of the functor. |
The functor must accept a point, and eventually a domain, and return a value whose type is Value.
A typical usage would be:
resulting in:
In you want to use a function instead of a functor or lambda, consider wrapping it into a lambda to avoid a performance penalty due to the fact that a pointer to a function cannot be inlined:
This example is illustrated in Constant image from a function, functor or lambda and you can find more informations about how to use this class appropriately in the module about Using functions, functors and lambdas in DGtal .
Definition at line 104 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::ConstIterator = boost::transform_iterator< std::reference_wrapper<const Self>, typename Domain::ConstIterator > |
Definition at line 123 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::ConstReverseIterator = boost::reverse_iterator< ConstIterator > |
Definition at line 124 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Dimension = typename Domain::Dimension |
Definition at line 118 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Domain = TDomain |
Definition at line 113 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Functor = TFunctor |
Definition at line 121 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Integer = typename Domain::Integer |
Definition at line 116 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Point = typename Domain::Point |
Definition at line 114 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Self = ConstImageFunctorHolder<TDomain, TValue, TFunctor> |
Definition at line 112 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Size = typename Domain::Size |
Definition at line 117 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Value = TValue |
Definition at line 120 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Vector = typename Domain::Vector |
Definition at line 115 of file ConstImageFunctorHolder.h.
| using DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::Vertex = Point |
Definition at line 119 of file ConstImageFunctorHolder.h.
|
inlineexplicit |
Constructor.
| aDomain | The domain of the image. |
| aFunctor | The functor taking point as parameter. |
Definition at line 144 of file ConstImageFunctorHolder.h.
|
private |
| DGtal::functors::ConstImageFunctorHolder< TDomain, TValue, TFunctor >::BOOST_STATIC_CONSTANT | ( | Dimension | , |
| dimension | = Domain::Space::dimension ) |
|
inline |
Returns a constant range over this image.
Definition at line 198 of file ConstImageFunctorHolder.h.
|
inline |
Returns the associated domain.
Definition at line 155 of file ConstImageFunctorHolder.h.
References myDomain.
|
inlineconstexpr |
Checks the validity/consistency of the object.
Definition at line 216 of file ConstImageFunctorHolder.h.
|
inline |
Evaluates the functor at the given point.
| TPoint | point type (auto-deduced). |
| aPoint | the point. |
Definition at line 171 of file ConstImageFunctorHolder.h.
|
inline |
|
inline |
Writes/Displays the object on an output stream.
| out | the output stream where the object is written. |
Definition at line 207 of file ConstImageFunctorHolder.h.
|
private |
The image domain.
Definition at line 133 of file ConstImageFunctorHolder.h.
Referenced by ConstImageFunctorHolder(), domain(), operator()(), operator()(), and selfDisplay().
|
private |
The functor that generates the image.
Definition at line 134 of file ConstImageFunctorHolder.h.
Referenced by ConstImageFunctorHolder(), operator()(), operator()(), and selfDisplay().