DGtal  1.5.beta
DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate > Class Template Reference

Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an implicitly define shape. The whole boundary is not precomputed nor stored. You may use an iterator to visit it. More...

#include <DGtal/topology/LightImplicitDigitalSurface.h>

Data Structures

class  Tracker
 
struct  VertexMap
 

Public Types

typedef LightImplicitDigitalSurface< TKSpace, TPointPredicate > Self
 
typedef TKSpace KSpace
 Model of cellular grid space. More...
 
typedef KSpace::SCell Surfel
 Type for surfels. More...
 
typedef KSpace::Size Size
 Type for sizes (unsigned integral type). More...
 
typedef TPointPredicate PointPredicate
 
typedef SurfelAdjacency< KSpace::dimension > Adjacency
 
typedef KSpace::Cell Cell
 
typedef KSpace::SCell SCell
 
typedef KSpace::CellSet CellSet
 
typedef KSpace::SCellSet SCellSet
 
typedef Surfel Vertex
 
typedef SCellSet VertexSet
 
typedef BreadthFirstVisitor< SelfSelfVisitor
 
typedef GraphVisitorRange< SelfVisitorSelfVisitorRange
 
typedef SelfVisitorRange::ConstIterator SurfelConstIterator
 
typedef KSpace::Space Space
 
typedef KSpace::Point Point
 
typedef Tracker DigitalSurfaceTracker
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CPointPredicate< PointPredicate >))
 
 ~LightImplicitDigitalSurface ()
 
 LightImplicitDigitalSurface (const LightImplicitDigitalSurface &other)
 
 LightImplicitDigitalSurface (ConstAlias< KSpace > aKSpace, ConstAlias< PointPredicate > aPP, const Adjacency &adj, const Surfel &s)
 
const AdjacencysurfelAdjacency () const
 accessor to surfel adjacency. More...
 
AdjacencysurfelAdjacency ()
 mutator to surfel adjacency. More...
 
const PointPredicatepointPredicate () const
 accessor to point predicate. More...
 
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
 
Size degree (const Vertex &v) const
 
template<typename OutputIterator >
void writeNeighbors (OutputIterator &it, const Vertex &v) const
 
template<typename OutputIterator , typename VertexPredicate >
void writeNeighbors (OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const
 
Size bestCapacity () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Private Member Functions

LightImplicitDigitalSurfaceoperator= (const LightImplicitDigitalSurface &other)
 

Private Attributes

const KSpacemyKSpace
 a reference to the cellular space. More...
 
const PointPredicatemyPointPredicate
 a reference to the point predicate defining the shape. More...
 
Adjacency mySurfelAdjacency
 the surfel adjacency used to determine neighbors. More...
 
Surfel mySurfel
 a surfel belonging to the surface. More...
 
Tracker myTracker
 Internal tracker for visiting surfels. More...
 

Detailed Description

template<typename TKSpace, typename TPointPredicate>
class DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >

Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an implicitly define shape. The whole boundary is not precomputed nor stored. You may use an iterator to visit it.

Description of template class 'LightImplicitDigitalSurface'

It is also a model of CUndirectedSimpleLocalGraph, so as to be able to visit itself with a BreadthFirstVisitor. The "Light" or lazyness is implemented this way.

Template Parameters
TKSpacea model of CCellularGridSpaceND: the type chosen for the cellular grid space.
TPointPredicatea model of concepts::CPointPredicate: this functor defines the inside of a shape on points where it is true.
Remarks
Being a CDigitalSurfaceContainer, it is a model of CConstSinglePassRange, but it is not a model of CConstBidirectionalRange. For instance, if you wish to do an algorithm like: for all vertex x, for all vertex y, compute something, then the following code will not work:
// This snippet does NOT work.
const SurfelConstIterator itb = mySurface.begin();
const SurfelConstIterator ite = mySurface.end();
for ( SurfelConstIterator itX = itb; itX != ite; ++itX )
{
for ( SurfelConstIterator itY = itb; itY != ite; ++itY )
{ // compute something with *itX and *itY. }
// now itX == itY == ite !
}
SelfVisitorRange::ConstIterator SurfelConstIterator

You may use this range only once ! This is because the iterators are only single pass. If you wish to visit twice the range, you must indeed creates two ranges by calling begin() twice (end() is not compulsory here, but advised).

// This snippet does ALWAYS work.
for ( SurfelConstIterator itX = mySurface.begin(),
itXEnd = mySurface.end();
itX != itXEnd; ++itX )
{
for ( SurfelConstIterator itY = mySurface.begin(),
itYEnd = mySurface.end();
itY != itYEnd; ++itY )
{ // compute something with *itX and *itY. }
}
Examples
dec/exampleDECSurface.cpp.

Definition at line 115 of file LightImplicitDigitalSurface.h.

Member Typedef Documentation

◆ Adjacency

template<typename TKSpace , typename TPointPredicate >
typedef SurfelAdjacency<KSpace::dimension> DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Adjacency

Definition at line 214 of file LightImplicitDigitalSurface.h.

◆ Cell

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::Cell DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Cell

Definition at line 215 of file LightImplicitDigitalSurface.h.

◆ CellSet

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::CellSet DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::CellSet

Definition at line 217 of file LightImplicitDigitalSurface.h.

◆ DigitalSurfaceTracker

template<typename TKSpace , typename TPointPredicate >
typedef Tracker DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::DigitalSurfaceTracker

Definition at line 235 of file LightImplicitDigitalSurface.h.

◆ KSpace

template<typename TKSpace , typename TPointPredicate >
typedef TKSpace DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::KSpace

Model of cellular grid space.

Definition at line 201 of file LightImplicitDigitalSurface.h.

◆ Point

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::Point DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Point

Definition at line 234 of file LightImplicitDigitalSurface.h.

◆ PointPredicate

template<typename TKSpace , typename TPointPredicate >
typedef TPointPredicate DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::PointPredicate

Definition at line 207 of file LightImplicitDigitalSurface.h.

◆ SCell

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::SCell DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::SCell

Definition at line 216 of file LightImplicitDigitalSurface.h.

◆ SCellSet

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::SCellSet DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::SCellSet

Definition at line 218 of file LightImplicitDigitalSurface.h.

◆ Self

template<typename TKSpace , typename TPointPredicate >
typedef LightImplicitDigitalSurface<TKSpace,TPointPredicate> DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Self

Definition at line 199 of file LightImplicitDigitalSurface.h.

◆ SelfVisitor

template<typename TKSpace , typename TPointPredicate >
typedef BreadthFirstVisitor< Self > DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::SelfVisitor

Definition at line 230 of file LightImplicitDigitalSurface.h.

◆ SelfVisitorRange

template<typename TKSpace , typename TPointPredicate >
typedef GraphVisitorRange< SelfVisitor > DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::SelfVisitorRange

Definition at line 231 of file LightImplicitDigitalSurface.h.

◆ Size

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::Size DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Size

Type for sizes (unsigned integral type).

Definition at line 205 of file LightImplicitDigitalSurface.h.

◆ Space

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::Space DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Space

Definition at line 233 of file LightImplicitDigitalSurface.h.

◆ Surfel

template<typename TKSpace , typename TPointPredicate >
typedef KSpace::SCell DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Surfel

Type for surfels.

Definition at line 203 of file LightImplicitDigitalSurface.h.

◆ SurfelConstIterator

template<typename TKSpace , typename TPointPredicate >
typedef SelfVisitorRange::ConstIterator DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::SurfelConstIterator

Definition at line 232 of file LightImplicitDigitalSurface.h.

◆ Vertex

template<typename TKSpace , typename TPointPredicate >
typedef Surfel DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::Vertex

Definition at line 222 of file LightImplicitDigitalSurface.h.

◆ VertexSet

template<typename TKSpace , typename TPointPredicate >
typedef SCellSet DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::VertexSet

Definition at line 223 of file LightImplicitDigitalSurface.h.

Constructor & Destructor Documentation

◆ ~LightImplicitDigitalSurface()

template<typename TKSpace , typename TPointPredicate >
DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::~LightImplicitDigitalSurface ( )

Destructor.

◆ LightImplicitDigitalSurface() [1/2]

template<typename TKSpace , typename TPointPredicate >
DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::LightImplicitDigitalSurface ( const LightImplicitDigitalSurface< TKSpace, TPointPredicate > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ LightImplicitDigitalSurface() [2/2]

template<typename TKSpace , typename TPointPredicate >
DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::LightImplicitDigitalSurface ( ConstAlias< KSpace aKSpace,
ConstAlias< PointPredicate aPP,
const Adjacency adj,
const Surfel s 
)

Constructor from digital set.

Parameters
aKSpacea cellular grid space (referenced).
aPPa point predicate defining implicitly the shape (referenced).
adjthe surfel adjacency (for instance Adjacency( true ) is interior to exterior adjacency ).
sany surfel of aKSpace such that aPP is true in the interior and false in the exterior.

Member Function Documentation

◆ begin()

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

◆ bestCapacity()

template<typename TKSpace , typename TPointPredicate >
Size DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::bestCapacity ( ) const

Should return a reasonable estimation of the number of neighbors for all vertices. For instance a planar triangulation should return 6-8, a quad-mesh should return 4, digital surface is 2*(K::dimension-1).

Returns
2*(K::dimension-1)

◆ BOOST_CONCEPT_ASSERT()

template<typename TKSpace , typename TPointPredicate >
DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::BOOST_CONCEPT_ASSERT ( (concepts::CPointPredicate< PointPredicate >)  )

◆ connectedness()

template<typename TKSpace , typename TPointPredicate >
Connectedness DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::connectedness ( ) const
Returns
the connectedness of this surface. Either CONNECTED, DISCONNECTED, or UNKNOWN.

◆ degree()

template<typename TKSpace , typename TPointPredicate >
Size DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::degree ( const Vertex v) const
Parameters
vany vertex of this graph
Returns
the number of neighbors of this Vertex/Surfel.

◆ empty()

template<typename TKSpace , typename TPointPredicate >
bool DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::empty ( ) const
Returns
'true' is the surface has no surfels, 'false' otherwise. NB: O(1) operation.

◆ end()

template<typename TKSpace , typename TPointPredicate >
SurfelConstIterator DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::end ( ) const
Returns
an iterator after the last surfel of the digital surface (unspecified order).

◆ isInside()

template<typename TKSpace , typename TPointPredicate >
bool DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::isInside ( const Surfel s) const
Parameters
sany surfel of the space.
Returns
'true' if s belongs to this digital surface.

◆ isValid()

template<typename TKSpace , typename TPointPredicate >
bool DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ nbSurfels()

template<typename TKSpace , typename TPointPredicate >
Size DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::nbSurfels ( ) const
Returns
the number of surfels of this digital surface. NB: O(N) computational complexity where N is the number of surfels.

◆ newTracker()

template<typename TKSpace , typename TPointPredicate >
DigitalSurfaceTracker* DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::newTracker ( const Surfel s) const
Parameters
sany surfel of the space.
Precondition
'isInside( s )'
Returns
a dyn. alloc. pointer on a tracker positionned at s.

◆ operator=()

template<typename TKSpace , typename TPointPredicate >
LightImplicitDigitalSurface& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::operator= ( const LightImplicitDigitalSurface< TKSpace, TPointPredicate > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ pointPredicate()

template<typename TKSpace , typename TPointPredicate >
const PointPredicate& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::pointPredicate ( ) const

accessor to point predicate.

◆ selfDisplay()

template<typename TKSpace , typename TPointPredicate >
void DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ space()

template<typename TKSpace , typename TPointPredicate >
const KSpace& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::space ( ) const
Returns
the cellular space in which lives the surface.

◆ surfelAdjacency() [1/2]

template<typename TKSpace , typename TPointPredicate >
Adjacency& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::surfelAdjacency ( )

mutator to surfel adjacency.

◆ surfelAdjacency() [2/2]

template<typename TKSpace , typename TPointPredicate >
const Adjacency& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::surfelAdjacency ( ) const

accessor to surfel adjacency.

◆ writeNeighbors() [1/2]

template<typename TKSpace , typename TPointPredicate >
template<typename OutputIterator >
void DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::writeNeighbors ( OutputIterator &  it,
const Vertex v 
) const

Writes the neighbors of [v] in the output iterator [it]. Neighbors are given in no specific order.

Template Parameters
OutputIteratorthe type for the output iterator (e.g. back_insert_iterator<std::vector<Vertex> >).
Parameters
[in,out]itany output iterator on Vertex (*it++ should be allowed), which specifies where neighbors are written.
[in]vany vertex of this graph

◆ writeNeighbors() [2/2]

template<typename TKSpace , typename TPointPredicate >
template<typename OutputIterator , typename VertexPredicate >
void DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::writeNeighbors ( OutputIterator &  it,
const Vertex v,
const VertexPredicate &  pred 
) const

Writes the neighbors of [v], verifying the predicate [pred] in the output iterator [it]. Neighbors are given in no specific order.

Template Parameters
OutputIteratorthe type for the output iterator (e.g. back_insert_iterator<std::vector<Vertex> >).
VertexPredicateany type of predicate taking a Vertex as input.
Parameters
[in,out]itany output iterator on Vertex (*it++ should be allowed), which specifies where neighbors are written.
[in]vany vertex of this graph
[in]predthe predicate for selecting neighbors.

Field Documentation

◆ myKSpace

template<typename TKSpace , typename TPointPredicate >
const KSpace& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::myKSpace
private

a reference to the cellular space.

Definition at line 392 of file LightImplicitDigitalSurface.h.

◆ myPointPredicate

template<typename TKSpace , typename TPointPredicate >
const PointPredicate& DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::myPointPredicate
private

a reference to the point predicate defining the shape.

Definition at line 394 of file LightImplicitDigitalSurface.h.

◆ mySurfel

template<typename TKSpace , typename TPointPredicate >
Surfel DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfel
private

a surfel belonging to the surface.

Definition at line 398 of file LightImplicitDigitalSurface.h.

◆ mySurfelAdjacency

template<typename TKSpace , typename TPointPredicate >
Adjacency DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfelAdjacency
private

the surfel adjacency used to determine neighbors.

Definition at line 396 of file LightImplicitDigitalSurface.h.

◆ myTracker

template<typename TKSpace , typename TPointPredicate >
Tracker DGtal::LightImplicitDigitalSurface< TKSpace, TPointPredicate >::myTracker
mutableprivate

Internal tracker for visiting surfels.

Definition at line 400 of file LightImplicitDigitalSurface.h.


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