DGtal  0.9.4beta
Public Types | Public Member Functions | Private Attributes
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue > Class Template Reference

#include <DGtal/images/ImageHelper.h>

Collaboration diagram for DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >:
[legend]

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 PointPredicate * myPointPred
 
Value myVal
 
bool reverse
 

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

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.

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

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  {}
const Image * myImage
const pointor to an image
Definition: ImageHelper.h:425
Value myVal
constant value when functor answer true.
Definition: ImageHelper.h:431
bool reverse
reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0) ...
Definition: ImageHelper.h:434
const PointPredicate * myPointPred
const pointor to a predicate on points
Definition: ImageHelper.h:428

Member Function Documentation

template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CConstImage< Image >)  )
template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CPointPredicate< PointPredicate >)  )
template<typename Image , typename PointPredicate , typename TValue = DGtal::int32_t>
DGtal::ImageToConstantFunctor< Image, PointPredicate, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CQuantity< Value >)  )
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.

References 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.

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  {
401  return NumberTraits<Value>::ZERO;
402  }
403  }
404  else
405  {
406  if( myPointPred->operator()(aPoint) )
407  {
408  return myVal;
409  }
410  else
411  {
412  return NumberTraits<Value>::ZERO;
413  }
414  }
415  }
416  else
417  {
418  return NumberTraits<Value>::ZERO;
419  }
420  }
const Image * myImage
const pointor to an image
Definition: ImageHelper.h:425
Value myVal
constant value when functor answer true.
Definition: ImageHelper.h:431
bool reverse
reverse values returned by the predicate. (Some shapes consider inner as > 0, others as < 0) ...
Definition: ImageHelper.h:434
const PointPredicate * myPointPred
const pointor to a predicate on points
Definition: ImageHelper.h:428
const Domain & domain() const
Definition: Image.h:192

Field Documentation

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()().

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()().

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()().

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: