DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue > Class Template Reference

#include <DGtal/images/ImageHelper.h>

Public Types

typedef Image::Point Point
 
typedef TValue Value
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CConstImage< Image >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CPointPredicate< PointPredicate >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CQuantity< Value >))
 
 ImageToConstantFunctor (ConstAlias< Image > anImage, ConstAlias< PointPredicate > aPointPred, Value aVal=NumberTraits< Value >::ONE, bool reverseValues=false)
 
Value operator() (const Point &aPoint) const
 

Private Attributes

const ImagemyImage
 const pointor to an image
 
const PointPredicate * myPointPred
 const pointor to a predicate on points
 
Value myVal
 constant value when functor answer true.
 
bool reverse
 reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0)
 

Detailed Description

template<typename Image, typename PointPredicate, typename TValue = DGtal::int32_t>
class DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >

Create a Point Functor from a Point Predicate and an Image.

Template Parameters
Imagea model of CImage.
PointPredicatea model of concepts::CPointPredicate.
TValuea model of CQuantity. Type return by the functor.

Definition at line 347 of file ImageHelper.h.

Member Typedef Documentation

◆ Point

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
typedef Image::Point DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::Point

Definition at line 351 of file ImageHelper.h.

◆ Value

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
typedef TValue DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::Value

Definition at line 352 of file ImageHelper.h.

Constructor & Destructor Documentation

◆ ImageToConstantFunctor()

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::ImageToConstantFunctor ( ConstAlias< Image > anImage,
ConstAlias< PointPredicate > aPointPred,
Value aVal = NumberTraitsValue >::ONE,
bool reverseValues = false )
inline
Parameters
[in]anImageimage
[in]aPointPredpredicate on points
[in]aValconst value when functor answer true.
[in]reverseValuesused to reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0)

Definition at line 373 of file ImageHelper.h.

377 : myImage(&anImage),
378 myPointPred(&aPointPred),
379 myVal(aVal),
380 reverse(reverseValues)
381 {}
Value myVal
constant value when functor answer true.
bool reverse
reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0)
const Image * myImage
const pointor to an image
const PointPredicate * myPointPred
const pointor to a predicate on points

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/3]

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CConstImage< Image >) )

◆ BOOST_CONCEPT_ASSERT() [2/3]

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CPointPredicate< PointPredicate >) )

◆ BOOST_CONCEPT_ASSERT() [3/3]

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CQuantity< Value >) )

◆ operator()()

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
Value DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::operator() ( const Point & aPoint) const
inline
Parameters
[in]aPointpoint to evaluate.
Returns
val between ZERO or aVal

Definition at line 389 of file ImageHelper.h.

390 {
391 if ((myImage->domain().isInside(aPoint)))
392 {
393 if( reverse )
394 {
395 if( !myPointPred->operator()(aPoint) )
396 {
397 return myVal;
398 }
399 else
400 {
402 }
403 }
404 else
405 {
406 if( myPointPred->operator()(aPoint) )
407 {
408 return myVal;
409 }
410 else
411 {
413 }
414 }
415 }
416 else
417 {
419 }
420 }
const Domain & domain() const
Definition Image.h:192
const Point aPoint(3, 4)

References aPoint(), DGtal::Image< TImageContainer >::domain(), DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myImage, DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myPointPred, DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myVal, and DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::reverse.

Field Documentation

◆ myImage

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
const Image* DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myImage
private

const pointor to an image

Definition at line 425 of file ImageHelper.h.

Referenced by DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::operator()().

◆ myPointPred

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
const PointPredicate* DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myPointPred
private

const pointor to a predicate on points

Definition at line 428 of file ImageHelper.h.

Referenced by DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::operator()().

◆ myVal

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
Value DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::myVal
private

constant value when functor answer true.

Definition at line 431 of file ImageHelper.h.

Referenced by DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::operator()().

◆ reverse

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
bool DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::reverse
private

reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0)

Definition at line 434 of file ImageHelper.h.

Referenced by DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::operator()().


The documentation for this class was generated from the following file: