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

#include <ExplicitDigitalSurface.h>

Collaboration diagram for DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >:
Collaboration graph
[legend]

Data Structures

class  Tracker

Public Types

typedef ExplicitDigitalSurface
< TKSpace, TSurfelPredicate > 
Self
typedef TKSpace KSpace
typedef KSpace::SCell Surfel
typedef KSpace::Size Size
typedef TSurfelPredicate SurfelPredicate
typedef std::vector< SurfelSurfelStorage
typedef
SurfelStorage::const_iterator 
SurfelConstIterator
typedef KSpace::Space Space
typedef KSpace::Point Point
typedef Tracker DigitalSurfaceTracker
typedef SurfelAdjacency
< KSpace::dimension > 
Adjacency
typedef KSpace::Cell Cell
typedef KSpace::SCell SCell
typedef KSpace::CellSet CellSet
typedef KSpace::SCellSet SCellSet

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CSurfelPredicate< SurfelPredicate >))
 ~ExplicitDigitalSurface ()
 ExplicitDigitalSurface (const ExplicitDigitalSurface &other)
 ExplicitDigitalSurface (const KSpace &aKSpace, const SurfelPredicate &aSP, const Adjacency &adj, const Surfel &s, bool closed=false)
const AdjacencysurfelAdjacency () const
AdjacencysurfelAdjacency ()
const SurfelPredicatesurfelPredicate () const
const KSpacespace () const
bool isInside (const Surfel &s) const
SurfelConstIterator begin () const
SurfelConstIterator end () const
Size nbSurfels () const
bool empty () const
DigitalSurfaceTrackernewTracker (const Surfel &s) const
Connectedness connectedness () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Protected Member Functions

void computeSurfels (const Surfel &p, bool closed)

Private Member Functions

ExplicitDigitalSurfaceoperator= (const ExplicitDigitalSurface &other)

Private Attributes

const KSpacemyKSpace
const SurfelPredicatemySurfelPredicate
Adjacency mySurfelAdjacency
SurfelStorage mySurfels

Detailed Description

template<typename TKSpace, typename TSurfelPredicate>
class DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >

Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels. The shape is determined by a predicate telling whether a given surfel belongs or not to the shape boundary. Compute once the boundary of the surface with a tracking.

Description of template class 'ExplicitDigitalSurface'

Note that in the 2D case, this object corresponds to a digital contour made of linels, ordered as a direct orientation sequence. If the contour is open, then begin() returns one extremity while end() is the surfel past the last extremity. If the contour is closed, then begin() is the surfel given at the instantiation of the object.

Template Parameters:
TKSpacea model of CCellularGridSpaceND: the type chosen for the cellular grid space.
TSurfelPredicatea model of CSurfelPredicate: this functor defines the digital surface as a characteristic function returning true iff the surfel belongs to it.
Examples:
topology/frontierAndBoundary.cpp.

Definition at line 80 of file ExplicitDigitalSurface.h.


Member Typedef Documentation

template<typename TKSpace, typename TSurfelPredicate>
typedef SurfelAdjacency<KSpace::dimension> DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Adjacency

Definition at line 186 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::Cell DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Cell

Definition at line 187 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::CellSet DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::CellSet

Definition at line 189 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef Tracker DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::DigitalSurfaceTracker

Definition at line 182 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef TKSpace DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::KSpace

Model of cellular grid space.

Definition at line 166 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::Point DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Point

Definition at line 181 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::SCell DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SCell

Definition at line 188 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::SCellSet DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SCellSet

Definition at line 190 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef ExplicitDigitalSurface<TKSpace,TSurfelPredicate> DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Self

Definition at line 164 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::Size DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Size

Type for sizes (unsigned integral type).

Definition at line 170 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::Space DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Space

Definition at line 180 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef KSpace::SCell DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Surfel

Type for surfels.

Definition at line 168 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef SurfelStorage::const_iterator DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelConstIterator

Definition at line 179 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef TSurfelPredicate DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelPredicate

Definition at line 172 of file ExplicitDigitalSurface.h.

template<typename TKSpace, typename TSurfelPredicate>
typedef std::vector<Surfel> DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelStorage

Definition at line 178 of file ExplicitDigitalSurface.h.


Constructor & Destructor Documentation

template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::~ExplicitDigitalSurface ( )
inline

Destructor.

Definition at line 124 of file ExplicitDigitalSurface.ih.

{
}
template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::ExplicitDigitalSurface ( const ExplicitDigitalSurface< TKSpace, TSurfelPredicate > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

NB: O(N) computational complexity operation, where N is the number of surfels of the surface. This is due to the fact that the surface is stored explicitly.

Definition at line 131 of file ExplicitDigitalSurface.ih.

template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::ExplicitDigitalSurface ( const KSpace aKSpace,
const SurfelPredicate aSP,
const Adjacency adj,
const Surfel s,
bool  closed = false 
)
inline

Constructor from digital set.

Parameters:
aKSpacea cellular grid space (referenced).
aSPa surfel predicate defining the shape (referenced).
adjthe surfel adjacency (for instance Adjacency( true ) is interior to exterior adjacency ).
sany surfel of aKSpace such that aSP is true in the interior and false in the exterior.
closedwhen 'true', the surface is known to be closed, hence faster extraction can be performed, default is 'false'.

NB: O(N) computational complexity operation, where N is the number of surfels of the surface. This is due to the fact that, at construction, the surface is extracted and stored.

See also:
computeSurfels

Definition at line 142 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::computeSurfels().

: myKSpace( aKSpace ), mySurfelPredicate( aPP ), mySurfelAdjacency( adj )
{
computeSurfels( s, closed );
}

Member Function Documentation

template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelConstIterator DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::begin ( ) const
inline
Returns:
an iterator pointing on the first surfel of the digital surface (unspecified order).

Definition at line 201 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels.

{
return mySurfels.begin();
}
template<typename TKSpace, typename TSurfelPredicate>
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::BOOST_CONCEPT_ASSERT ( (CSurfelPredicate< SurfelPredicate >)  )
template<typename TKSpace , typename TSurfelPredicate >
void DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::computeSurfels ( const Surfel p,
bool  closed 
)
inlineprotected

Recomputes the set of boundary surfels from the point predicate and some initial surfel.

Parameters:
pany surfel of the surface
closedwhen 'true', the surface is known to be closed, hence faster extraction can be performed.

Definition at line 253 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::myKSpace, DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelAdjacency, DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelPredicate, and DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels.

Referenced by DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::ExplicitDigitalSurface().

{
mySurfels.clear();
if ( KSpace::dimension > 2 )
{
typename KSpace::SCellSet surface;
if ( closed )
p );
else
p );
for ( typename KSpace::SCellSet::const_iterator it = surface.begin(),
it_end = surface.end(); it != it_end; ++it )
mySurfels.push_back( *it );
}
else
{
ASSERT( KSpace::dimension == 2 );
p );
}
}
template<typename TKSpace , typename TSurfelPredicate >
DGtal::Connectedness DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::connectedness ( ) const
inline
Returns:
the connectedness of this surface. By construction CONNECTED.

Definition at line 242 of file ExplicitDigitalSurface.ih.

References DGtal::CONNECTED.

{
return CONNECTED;
}
template<typename TKSpace , typename TSurfelPredicate >
bool DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::empty ( ) const
inline
Returns:
'true' is the surface has no surfels, 'false' otherwise. NB: O(1) operation.

Definition at line 225 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels.

{
return mySurfels.empty();
}
template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelConstIterator DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::end ( ) const
inline
Returns:
an iterator after the last surfel of the digital surface (unspecified order).

Definition at line 209 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels.

{
return mySurfels.end();
}
template<typename TKSpace , typename TSurfelPredicate >
bool DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::isInside ( const Surfel s) const
inline
Parameters:
sany surfel of the space.
Returns:
'true' if s belongs to this digital surface.

Definition at line 193 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelPredicate().

Referenced by DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Tracker::move().

{
return surfelPredicate()( s );
}
template<typename TKSpace , typename TSurfelPredicate >
bool DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 308 of file ExplicitDigitalSurface.ih.

{
return true;
}
template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Size DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::nbSurfels ( ) const
inline
Returns:
the number of surfels of this digital surface. NB: O(1)

Definition at line 217 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels.

{
return mySurfels.size();
}
template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::DigitalSurfaceTracker * DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::newTracker ( const Surfel s) const
inline
Parameters:
sany surfel of the space.
Precondition:
'isInside( s )'
Returns:
a dyn. alloc. pointer on a tracker positionned at s.

Definition at line 234 of file ExplicitDigitalSurface.ih.

{
return new Tracker( *this, s );
}
template<typename TKSpace, typename TSurfelPredicate>
ExplicitDigitalSurface& DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::operator= ( const ExplicitDigitalSurface< TKSpace, TSurfelPredicate > &  other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TKSpace , typename TSurfelPredicate >
void DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 296 of file ExplicitDigitalSurface.ih.

{
out << "[ExplicitDigitalSurface]";
}
template<typename TKSpace , typename TSurfelPredicate >
const DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::KSpace & DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::space ( ) const
inline
Returns:
the cellular space in which lives the surface.

Definition at line 184 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::myKSpace.

Referenced by DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Tracker::Tracker().

{
return myKSpace;
}
template<typename TKSpace , typename TSurfelPredicate >
const DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Adjacency & DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelAdjacency ( ) const
inline
template<typename TKSpace , typename TSurfelPredicate >
DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Adjacency & DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelAdjacency ( )
inline

mutator to surfel adjacency.

Definition at line 164 of file ExplicitDigitalSurface.ih.

References DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelAdjacency.

{
}
template<typename TKSpace , typename TSurfelPredicate >
const DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelPredicate & DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelPredicate ( ) const
inline

Field Documentation

template<typename TKSpace, typename TSurfelPredicate>
const KSpace& DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::myKSpace
private
template<typename TKSpace, typename TSurfelPredicate>
Adjacency DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelAdjacency
private
template<typename TKSpace, typename TSurfelPredicate>
const SurfelPredicate& DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelPredicate
private
template<typename TKSpace, typename TSurfelPredicate>
SurfelStorage DGtal::ExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfels
private

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