DGtal 1.3.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > Class Template Reference

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. The whole boundary is not precomputed nor stored. You may use an iterator to visit it. More...

#include <DGtal/topology/LightExplicitDigitalSurface.h>

Data Structures

class  Tracker
 
struct  VertexMap
 

Public Types

typedef LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > 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 TSurfelPredicate SurfelPredicate
 
typedef SurfelAdjacency< KSpace::dimensionAdjacency
 
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::CSurfelPredicate< SurfelPredicate >))
 
 ~LightExplicitDigitalSurface ()
 
 LightExplicitDigitalSurface (const LightExplicitDigitalSurface &other)
 
 LightExplicitDigitalSurface (ConstAlias< KSpace > aKSpace, ConstAlias< SurfelPredicate > aSP, const Adjacency &adj, const Surfel &s)
 
const AdjacencysurfelAdjacency () const
 accessor to surfel adjacency. More...
 
AdjacencysurfelAdjacency ()
 mutator to surfel adjacency. More...
 
const SurfelPredicatesurfelPredicate () const
 accessor to surfel predicate. More...
 
const Surfelsurfel () const
 accessor to starting surfel. More...
 
void setSurfel (const Surfel &aSurfel)
 mutator to starting surfel. 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

LightExplicitDigitalSurfaceoperator= (const LightExplicitDigitalSurface &other)
 

Private Attributes

const KSpacemyKSpace
 a reference to the cellular space. More...
 
const SurfelPredicatemySurfelPredicate
 a reference to the surfel 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 TSurfelPredicate>
class DGtal::LightExplicitDigitalSurface< 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. The whole boundary is not precomputed nor stored. You may use an iterator to visit it.

Description of template class 'LightExplicitDigitalSurface'

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.
TSurfelPredicatea model of CSurfelPredicate: this functor defines the digital surface as a characteristic function returning true iff the surfel belongs to it.
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.
// But itX == itY at each step ! }
// now itX == itY == ite !
}

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
geometry/volumes/distance/exampleFMM3D.cpp, and tutorial-examples/FMMErosion.cpp.

Definition at line 118 of file LightExplicitDigitalSurface.h.

Member Typedef Documentation

◆ Adjacency

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

Definition at line 217 of file LightExplicitDigitalSurface.h.

◆ Cell

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

Definition at line 218 of file LightExplicitDigitalSurface.h.

◆ CellSet

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

Definition at line 220 of file LightExplicitDigitalSurface.h.

◆ DigitalSurfaceTracker

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

Definition at line 238 of file LightExplicitDigitalSurface.h.

◆ KSpace

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

Model of cellular grid space.

Definition at line 204 of file LightExplicitDigitalSurface.h.

◆ Point

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

Definition at line 237 of file LightExplicitDigitalSurface.h.

◆ SCell

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

Definition at line 219 of file LightExplicitDigitalSurface.h.

◆ SCellSet

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

Definition at line 221 of file LightExplicitDigitalSurface.h.

◆ Self

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

Definition at line 202 of file LightExplicitDigitalSurface.h.

◆ SelfVisitor

template<typename TKSpace , typename TSurfelPredicate >
typedef BreadthFirstVisitor< Self > DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SelfVisitor

Definition at line 233 of file LightExplicitDigitalSurface.h.

◆ SelfVisitorRange

template<typename TKSpace , typename TSurfelPredicate >
typedef GraphVisitorRange< SelfVisitor > DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SelfVisitorRange

Definition at line 234 of file LightExplicitDigitalSurface.h.

◆ Size

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

Type for sizes (unsigned integral type).

Definition at line 208 of file LightExplicitDigitalSurface.h.

◆ Space

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

Definition at line 236 of file LightExplicitDigitalSurface.h.

◆ Surfel

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

Type for surfels.

Definition at line 206 of file LightExplicitDigitalSurface.h.

◆ SurfelConstIterator

template<typename TKSpace , typename TSurfelPredicate >
typedef SelfVisitorRange::ConstIterator DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::SurfelConstIterator

Definition at line 235 of file LightExplicitDigitalSurface.h.

◆ SurfelPredicate

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

Definition at line 210 of file LightExplicitDigitalSurface.h.

◆ Vertex

template<typename TKSpace , typename TSurfelPredicate >
typedef Surfel DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::Vertex

Definition at line 225 of file LightExplicitDigitalSurface.h.

◆ VertexSet

template<typename TKSpace , typename TSurfelPredicate >
typedef SCellSet DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::VertexSet

Definition at line 226 of file LightExplicitDigitalSurface.h.

Constructor & Destructor Documentation

◆ ~LightExplicitDigitalSurface()

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

Destructor.

◆ LightExplicitDigitalSurface() [1/2]

template<typename TKSpace , typename TSurfelPredicate >
DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::LightExplicitDigitalSurface ( const LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ LightExplicitDigitalSurface() [2/2]

template<typename TKSpace , typename TSurfelPredicate >
DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::LightExplicitDigitalSurface ( ConstAlias< KSpace aKSpace,
ConstAlias< SurfelPredicate aSP,
const Adjacency adj,
const Surfel s 
)

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 aPP is true in the interior and false in the exterior.

Member Function Documentation

◆ begin()

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

◆ bestCapacity()

template<typename TKSpace , typename TSurfelPredicate >
Size DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::BOOST_CONCEPT_ASSERT ( (concepts::CSurfelPredicate< SurfelPredicate >)  )

◆ connectedness()

template<typename TKSpace , typename TSurfelPredicate >
Connectedness DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::connectedness ( ) const
Returns
the connectedness of this surface. By construction CONNECTED.

◆ degree()

template<typename TKSpace , typename TSurfelPredicate >
Size DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
bool DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::empty ( ) const
Returns
'true' is the surface has no surfels, 'false' otherwise. NB: O(1) operation.

◆ end()

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

◆ isInside()

template<typename TKSpace , typename TSurfelPredicate >
bool DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
bool DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ nbSurfels()

template<typename TKSpace , typename TSurfelPredicate >
Size DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
DigitalSurfaceTracker * DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
LightExplicitDigitalSurface & DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::operator= ( const LightExplicitDigitalSurface< TKSpace, TSurfelPredicate > &  other)
private

Assignment.

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

◆ selfDisplay()

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

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setSurfel()

template<typename TKSpace , typename TSurfelPredicate >
void DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::setSurfel ( const Surfel aSurfel)

mutator to starting surfel.

◆ space()

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

◆ surfel()

template<typename TKSpace , typename TSurfelPredicate >
const Surfel & DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfel ( ) const

accessor to starting surfel.

◆ surfelAdjacency() [1/2]

template<typename TKSpace , typename TSurfelPredicate >
Adjacency & DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelAdjacency ( )

mutator to surfel adjacency.

◆ surfelAdjacency() [2/2]

template<typename TKSpace , typename TSurfelPredicate >
const Adjacency & DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelAdjacency ( ) const

accessor to surfel adjacency.

◆ surfelPredicate()

template<typename TKSpace , typename TSurfelPredicate >
const SurfelPredicate & DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::surfelPredicate ( ) const

accessor to surfel predicate.

◆ writeNeighbors() [1/2]

template<typename TKSpace , typename TSurfelPredicate >
template<typename OutputIterator >
void DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
template<typename OutputIterator , typename VertexPredicate >
void DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::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 TSurfelPredicate >
const KSpace& DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::myKSpace
private

a reference to the cellular space.

Definition at line 398 of file LightExplicitDigitalSurface.h.

◆ mySurfel

template<typename TKSpace , typename TSurfelPredicate >
Surfel DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfel
private

a surfel belonging to the surface.

Definition at line 404 of file LightExplicitDigitalSurface.h.

◆ mySurfelAdjacency

template<typename TKSpace , typename TSurfelPredicate >
Adjacency DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelAdjacency
private

the surfel adjacency used to determine neighbors.

Definition at line 402 of file LightExplicitDigitalSurface.h.

◆ mySurfelPredicate

template<typename TKSpace , typename TSurfelPredicate >
const SurfelPredicate& DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::mySurfelPredicate
private

a reference to the surfel predicate defining the shape.

Definition at line 400 of file LightExplicitDigitalSurface.h.

◆ myTracker

template<typename TKSpace , typename TSurfelPredicate >
Tracker DGtal::LightExplicitDigitalSurface< TKSpace, TSurfelPredicate >::myTracker
mutableprivate

Internal tracker for visiting surfels.

Definition at line 406 of file LightExplicitDigitalSurface.h.


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