DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Attributes
DGtal::FrontierPredicate< TKSpace, TImage > Class Template Reference

#include <FrontierPredicate.h>

Public Types

typedef TKSpace KSpace
typedef TImage Image
typedef KSpace::Surfel Surfel
typedef KSpace::Point Point
typedef KSpace::SCell SCell
typedef Image::Value Value

Public Member Functions

 BOOST_STATIC_ASSERT ((ConceptUtils::SameType< typename KSpace::Point, typename Image::Point >::value))
 ~FrontierPredicate ()
 FrontierPredicate (const KSpace &aSpace, const Image &anImage, const Value &l1, const Value &l2)
 FrontierPredicate (const FrontierPredicate &other)
FrontierPredicateoperator= (const FrontierPredicate &other)
bool operator() (const Surfel &s) const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Attributes

const KSpacemyPtrSpace
const ImagemyPtrImage
Value myLabel1
Value myLabel2

Detailed Description

template<typename TKSpace, typename TImage>
class DGtal::FrontierPredicate< TKSpace, TImage >

Aim: The predicate on surfels that represents the frontier between two regions in an image. It can be used with ExplicitDigitalSurface or LightExplicitDigitalSurface so as to define a digital surface. Such surfaces may of course be open.

Description of class 'FrontierPredicate'

Template Parameters:
KSpaceany model of cellular space
TImageany model of Image
Examples:
topology/frontierAndBoundary.cpp.

Definition at line 65 of file FrontierPredicate.h.


Member Typedef Documentation

template<typename TKSpace, typename TImage>
typedef TImage DGtal::FrontierPredicate< TKSpace, TImage >::Image

Definition at line 70 of file FrontierPredicate.h.

template<typename TKSpace, typename TImage>
typedef TKSpace DGtal::FrontierPredicate< TKSpace, TImage >::KSpace

Definition at line 69 of file FrontierPredicate.h.

template<typename TKSpace, typename TImage>
typedef KSpace::Point DGtal::FrontierPredicate< TKSpace, TImage >::Point

Definition at line 72 of file FrontierPredicate.h.

template<typename TKSpace, typename TImage>
typedef KSpace::SCell DGtal::FrontierPredicate< TKSpace, TImage >::SCell

Definition at line 73 of file FrontierPredicate.h.

template<typename TKSpace, typename TImage>
typedef KSpace::Surfel DGtal::FrontierPredicate< TKSpace, TImage >::Surfel

Definition at line 71 of file FrontierPredicate.h.

template<typename TKSpace, typename TImage>
typedef Image::Value DGtal::FrontierPredicate< TKSpace, TImage >::Value

Definition at line 74 of file FrontierPredicate.h.


Constructor & Destructor Documentation

template<typename TKSpace , typename TImage >
DGtal::FrontierPredicate< TKSpace, TImage >::~FrontierPredicate ( )
inline

Destructor.

Definition at line 45 of file FrontierPredicate.ih.

{}
template<typename TKSpace , typename TImage >
DGtal::FrontierPredicate< TKSpace, TImage >::FrontierPredicate ( const KSpace aSpace,
const Image anImage,
const Value l1,
const Value l2 
)
inline

Constructor. The frontier will be defined only with the image domain. The space must be large enough to contain the frontier.

Parameters:
aSpacea cellular grid space (referenced).
anImageany image (referenced).
l1a label in the image that defines the inner region.
l2a label in the image that defines the outer region.

Definition at line 51 of file FrontierPredicate.ih.

: myPtrSpace( &aSpace ), myPtrImage( &anImage ),
myLabel1( l1 ), myLabel2( l2 )
{}
template<typename TKSpace , typename TImage >
DGtal::FrontierPredicate< TKSpace, TImage >::FrontierPredicate ( const FrontierPredicate< TKSpace, TImage > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 60 of file FrontierPredicate.ih.

: myPtrSpace( other.myPtrSpace ), myPtrImage( other.myPtrImage ),
myLabel1( other.myLabel1 ), myLabel2( other.myLabel2 )
{}

Member Function Documentation

template<typename TKSpace, typename TImage>
DGtal::FrontierPredicate< TKSpace, TImage >::BOOST_STATIC_ASSERT ( (ConceptUtils::SameType< typename KSpace::Point, typename Image::Point >::value)  )
template<typename TKSpace , typename TImage >
bool DGtal::FrontierPredicate< TKSpace, TImage >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 110 of file FrontierPredicate.ih.

{
return true;
}
template<typename TKSpace , typename TImage >
bool DGtal::FrontierPredicate< TKSpace, TImage >::operator() ( const Surfel s) const
inline

Predicate operator.

Parameters:
sany surfel
Returns:
'true' iff s has its inner voxel that has label myLabel1 in image myImage and its outer voxel that has label myLabel2 in image myImage.

Definition at line 85 of file FrontierPredicate.ih.

{
Dimension orthDir = myPtrSpace->sOrthDir( s );
bool orthDirect = myPtrSpace->sDirect( s, orthDir );
SCell int_spel = myPtrSpace->sIncident( s, orthDir, orthDirect );
Point int_p = myPtrSpace->sCoords( int_spel );
Point out_p = int_p;
out_p[ orthDir ] += orthDirect ? -1 : 1;
return ( (*myPtrImage)( int_p ) == myLabel1 )
&& ( (*myPtrImage)( out_p ) == myLabel2 );
}
template<typename TKSpace , typename TImage >
DGtal::FrontierPredicate< TKSpace, TImage > & DGtal::FrontierPredicate< TKSpace, TImage >::operator= ( const FrontierPredicate< TKSpace, TImage > &  other)
inline

Assignment. Required by CSurfelPredicate.

Parameters:
otherthe object to clone.
Returns:
a reference to this object.

Definition at line 69 of file FrontierPredicate.ih.

References DGtal::FrontierPredicate< TKSpace, TImage >::myLabel1, DGtal::FrontierPredicate< TKSpace, TImage >::myLabel2, DGtal::FrontierPredicate< TKSpace, TImage >::myPtrImage, and DGtal::FrontierPredicate< TKSpace, TImage >::myPtrSpace.

{
if ( this != &other )
{
myPtrSpace = other.myPtrSpace;
myPtrImage = other.myPtrImage;
myLabel1 = other.myLabel1;
myLabel2 = other.myLabel2;
}
return *this;
}
template<typename TKSpace , typename TImage >
void DGtal::FrontierPredicate< TKSpace, TImage >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 101 of file FrontierPredicate.ih.

{
out << "[FrontierPredicate]";
}

Field Documentation

template<typename TKSpace, typename TImage>
Value DGtal::FrontierPredicate< TKSpace, TImage >::myLabel1
private

the label of the inner region that defines the frontier.

Definition at line 148 of file FrontierPredicate.h.

Referenced by DGtal::FrontierPredicate< TKSpace, TImage >::operator=().

template<typename TKSpace, typename TImage>
Value DGtal::FrontierPredicate< TKSpace, TImage >::myLabel2
private

the label of the outer region that defines the frontier.

Definition at line 150 of file FrontierPredicate.h.

Referenced by DGtal::FrontierPredicate< TKSpace, TImage >::operator=().

template<typename TKSpace, typename TImage>
const Image* DGtal::FrontierPredicate< TKSpace, TImage >::myPtrImage
private
template<typename TKSpace, typename TImage>
const KSpace* DGtal::FrontierPredicate< TKSpace, TImage >::myPtrSpace
private

the cellular space where lies the image.

Definition at line 144 of file FrontierPredicate.h.

Referenced by DGtal::FrontierPredicate< TKSpace, TImage >::operator=().


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