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::ImplicitDigitalSurface< TKSpace, TPointPredicate > Class Template Reference

#include <ImplicitDigitalSurface.h>

Collaboration diagram for DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >:
Collaboration graph
[legend]

Data Structures

class  Tracker

Public Types

typedef ImplicitDigitalSurface
< TKSpace, TPointPredicate > 
Self
typedef TKSpace KSpace
typedef KSpace::SCell Surfel
typedef KSpace::Size Size
typedef TPointPredicate PointPredicate
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 ((CPointPredicate< PointPredicate >))
 ~ImplicitDigitalSurface ()
 ImplicitDigitalSurface (const ImplicitDigitalSurface &other)
 ImplicitDigitalSurface (const KSpace &aKSpace, const PointPredicate &aPP, const Adjacency &adj, const Surfel &s, bool closed=false)
const AdjacencysurfelAdjacency () const
AdjacencysurfelAdjacency ()
const PointPredicatepointPredicate () 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

ImplicitDigitalSurfaceoperator= (const ImplicitDigitalSurface &other)

Private Attributes

const KSpacemyKSpace
const PointPredicatemyPointPredicate
Adjacency mySurfelAdjacency
SurfelStorage mySurfels

Detailed Description

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

Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an implicitly define shape. Compute once the boundary of the surface with a tracking.

Description of template class 'ImplicitDigitalSurface'

Template Parameters:
TKSpacea model of CCellularGridSpaceND: the type chosen for the cellular grid space.
TPointPredicatea model of CPointPredicate: this functor defines the inside of a shape on points where it is true.

Definition at line 70 of file ImplicitDigitalSurface.h.


Member Typedef Documentation

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

Definition at line 176 of file ImplicitDigitalSurface.h.

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

Definition at line 177 of file ImplicitDigitalSurface.h.

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

Definition at line 179 of file ImplicitDigitalSurface.h.

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

Definition at line 172 of file ImplicitDigitalSurface.h.

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

Model of cellular grid space.

Definition at line 156 of file ImplicitDigitalSurface.h.

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

Definition at line 171 of file ImplicitDigitalSurface.h.

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

Definition at line 162 of file ImplicitDigitalSurface.h.

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

Definition at line 178 of file ImplicitDigitalSurface.h.

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

Definition at line 180 of file ImplicitDigitalSurface.h.

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

Definition at line 154 of file ImplicitDigitalSurface.h.

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

Type for sizes (unsigned integral type).

Definition at line 160 of file ImplicitDigitalSurface.h.

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

Definition at line 170 of file ImplicitDigitalSurface.h.

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

Type for surfels.

Definition at line 158 of file ImplicitDigitalSurface.h.

template<typename TKSpace, typename TPointPredicate>
typedef SurfelStorage::const_iterator DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::SurfelConstIterator

Definition at line 169 of file ImplicitDigitalSurface.h.

template<typename TKSpace, typename TPointPredicate>
typedef std::vector<Surfel> DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::SurfelStorage

Definition at line 168 of file ImplicitDigitalSurface.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 123 of file ImplicitDigitalSurface.ih.

{
}
template<typename TKSpace , typename TPointPredicate >
DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::ImplicitDigitalSurface ( const ImplicitDigitalSurface< TKSpace, TPointPredicate > &  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 130 of file ImplicitDigitalSurface.ih.

template<typename TKSpace , typename TPointPredicate >
DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::ImplicitDigitalSurface ( const KSpace aKSpace,
const PointPredicate aPP,
const Adjacency adj,
const Surfel s,
bool  closed = false 
)
inline

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.
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 141 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::computeSurfels().

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

Member Function Documentation

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

Definition at line 213 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels.

{
return mySurfels.begin();
}
template<typename TKSpace, typename TPointPredicate>
DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::BOOST_CONCEPT_ASSERT ( (CPointPredicate< PointPredicate >)  )
template<typename TKSpace , typename TPointPredicate >
void DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::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 265 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myKSpace, DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myPointPredicate, DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfelAdjacency, and DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels.

Referenced by DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::ImplicitDigitalSurface().

{
mySurfels.clear();
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 );
}
template<typename TKSpace , typename TPointPredicate >
DGtal::Connectedness DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::connectedness ( ) const
inline
Returns:
the connectedness of this surface. Either CONNECTED, DISCONNECTED, or UNKNOWN.

Definition at line 254 of file ImplicitDigitalSurface.ih.

References DGtal::CONNECTED.

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

Definition at line 237 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels.

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

Definition at line 221 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels.

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

Definition at line 192 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myKSpace, and DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myPointPredicate.

Referenced by DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::Tracker::move().

{
Dimension k = myKSpace.sOrthDir( s );
// checks if the surfel is on the space boundary.
if ( myKSpace.sIsMax( s, k ) || myKSpace.sIsMin( s, k ) )
return false;
// p1 must be in the set and p2 must not be in the set.
SCell spel1 = myKSpace.sDirectIncident( s, k );
Point p1 = myKSpace.sCoords( spel1 );
if ( myPointPredicate( p1 ) )
{
SCell spel2 = myKSpace.sIndirectIncident( s, k );
Point p2 = myKSpace.sCoords( spel2 );
return ! myPointPredicate( p2 );
}
return false;
}
template<typename TKSpace , typename TPointPredicate >
bool DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::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 ImplicitDigitalSurface.ih.

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

Definition at line 229 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels.

{
return mySurfels.size();
}
template<typename TKSpace , typename TPointPredicate >
DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::DigitalSurfaceTracker * DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::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 246 of file ImplicitDigitalSurface.ih.

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

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TKSpace , typename TPointPredicate >
const DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::PointPredicate & DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::pointPredicate ( ) const
inline
template<typename TKSpace , typename TPointPredicate >
void DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::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 ImplicitDigitalSurface.ih.

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

Definition at line 183 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myKSpace.

Referenced by DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::Tracker::Tracker().

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

mutator to surfel adjacency.

Definition at line 163 of file ImplicitDigitalSurface.ih.

References DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfelAdjacency.

{
}

Field Documentation

template<typename TKSpace, typename TPointPredicate>
const KSpace& DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myKSpace
private
template<typename TKSpace, typename TPointPredicate>
const PointPredicate& DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::myPointPredicate
private
template<typename TKSpace, typename TPointPredicate>
Adjacency DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfelAdjacency
private
template<typename TKSpace, typename TPointPredicate>
SurfelStorage DGtal::ImplicitDigitalSurface< TKSpace, TPointPredicate >::mySurfels
private

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