DGtal  0.9.3beta
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DGtal::DigitalSetFromMap< TMapImage > Class Template Reference

#include <DGtal/kernel/sets/DigitalSetFromMap.h>

Collaboration diagram for DGtal::DigitalSetFromMap< TMapImage >:
[legend]

Public Types

typedef TMapImage Image
 
typedef std::pair< const typename Image::Point, typename Image::ValuePair
 
typedef DigitalSetFromMap< ImageSelf
 
typedef Image::Domain Domain
 
typedef Domain::Point Point
 
typedef Domain::Size Size
 
typedef functors::Pair1st< PointFunctor
 
typedef ConstIteratorAdapter< typename Image::ConstIterator, Functor, PointConstIterator
 
typedef ConstIteratorAdapter< typename Image::ConstIterator, Functor, PointIterator
 

Public Member Functions

 ~DigitalSetFromMap ()
 
 DigitalSetFromMap (Image &aImage, const typename Image::Value &aDefaultValue=0)
 
 DigitalSetFromMap (const DigitalSetFromMap &other)
 
DigitalSetFromMapoperator= (const DigitalSetFromMap &other)
 
const Domaindomain () const
 
CowPtr< DomaindomainPointer () const
 
Size size () const
 
bool empty () const
 
void insert (const Point &p)
 
template<typename PointInputIterator >
void insert (PointInputIterator first, PointInputIterator last)
 
void insertNew (const Point &p)
 
template<typename PointInputIterator >
void insertNew (PointInputIterator first, PointInputIterator last)
 
Size erase (const Point &p)
 
void erase (Iterator it)
 
void erase (Iterator first, Iterator last)
 
void clear ()
 
ConstIterator find (const Point &p) const
 
Iterator find (const Point &p)
 
ConstIterator begin () const
 
ConstIterator end () const
 
Iterator begin ()
 
Iterator end ()
 
template<typename TDigitalSet >
Selfoperator+= (const TDigitalSet &aSet)
 
bool operator() (const Point &p) const
 
template<typename TOutputIterator >
void computeComplement (TOutputIterator &ito) const
 
template<typename TDigitalSet >
void assignFromComplement (const TDigitalSet &otherSet)
 
void computeBoundingBox (Point &lower, Point &upper) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Protected Member Functions

 DigitalSetFromMap ()
 

Protected Attributes

ImagemyImgPtr
 
Functor myFun
 
Image::Value myDefault
 

Detailed Description

template<typename TMapImage>
class DGtal::DigitalSetFromMap< TMapImage >

Aim: An adapter for viewing an associative image container like ImageContainerBySTLMap as a simple digital set. This class is merely based on an aliasing pointer on the image, which must exists elsewhere.

Description of template class 'DigitalSetFromMap'

Model of CDigitalSet.

Template Parameters
TMapImagetype of associative image container
Examples:
geometry/volumes/distance/exampleFMM2D.cpp, geometry/volumes/distance/exampleFMM3D.cpp, and tutorial-examples/FMMErosion.cpp.

Definition at line 74 of file DigitalSetFromMap.h.

Member Typedef Documentation

template<typename TMapImage>
typedef ConstIteratorAdapter<typename Image::ConstIterator, Functor, Point> DGtal::DigitalSetFromMap< TMapImage >::ConstIterator

Definition at line 89 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef Image::Domain DGtal::DigitalSetFromMap< TMapImage >::Domain

Definition at line 84 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef functors::Pair1st<Point> DGtal::DigitalSetFromMap< TMapImage >::Functor

Definition at line 88 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef TMapImage DGtal::DigitalSetFromMap< TMapImage >::Image

Definition at line 78 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef ConstIteratorAdapter<typename Image::ConstIterator, Functor, Point> DGtal::DigitalSetFromMap< TMapImage >::Iterator

Definition at line 90 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef std::pair<const typename Image::Point, typename Image::Value> DGtal::DigitalSetFromMap< TMapImage >::Pair

Definition at line 80 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef Domain::Point DGtal::DigitalSetFromMap< TMapImage >::Point

Definition at line 85 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef DigitalSetFromMap<Image> DGtal::DigitalSetFromMap< TMapImage >::Self

Definition at line 81 of file DigitalSetFromMap.h.

template<typename TMapImage>
typedef Domain::Size DGtal::DigitalSetFromMap< TMapImage >::Size

Definition at line 86 of file DigitalSetFromMap.h.

Constructor & Destructor Documentation

template<typename TMapImage>
DGtal::DigitalSetFromMap< TMapImage >::~DigitalSetFromMap ( )

Destructor.

template<typename TMapImage>
DGtal::DigitalSetFromMap< TMapImage >::DigitalSetFromMap ( Image aImage,
const typename Image::Value aDefaultValue = 0 
)

Constructor. Link the adapter to an existing image.

Parameters
aImageany associative image container.
aDefaultValuevalue assigned to new points in the underlying image (0 by default).
template<typename TMapImage>
DGtal::DigitalSetFromMap< TMapImage >::DigitalSetFromMap ( const DigitalSetFromMap< TMapImage > &  other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TMapImage>
DGtal::DigitalSetFromMap< TMapImage >::DigitalSetFromMap ( )
protected

Default Constructor. Forbidden since a Domain is necessary for defining a set.

Member Function Documentation

template<typename TMapImage>
template<typename TDigitalSet >
void DGtal::DigitalSetFromMap< TMapImage >::assignFromComplement ( const TDigitalSet &  otherSet)

Builds the complement in the domain of the set [other_set] in this.

Parameters
otherSetdefines the set whose complement is assigned to 'this'.
Template Parameters
TDigitalSeta model of digital set.
template<typename TMapImage>
ConstIterator DGtal::DigitalSetFromMap< TMapImage >::begin ( ) const
Returns
a const iterator on the first element in this set.
template<typename TMapImage>
Iterator DGtal::DigitalSetFromMap< TMapImage >::begin ( )
Returns
an iterator on the first element in this set.
template<typename TMapImage>
std::string DGtal::DigitalSetFromMap< TMapImage >::className ( ) const
Returns
the style name used for drawing this object.
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::clear ( )

Clears the set.

Postcondition
this set is empty.
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::computeBoundingBox ( Point lower,
Point upper 
) const

Computes the bounding box of this set.

Parameters
lowerthe first point of the bounding box (lowest in all directions).
upperthe last point of the bounding box (highest in all directions).
template<typename TMapImage>
template<typename TOutputIterator >
void DGtal::DigitalSetFromMap< TMapImage >::computeComplement ( TOutputIterator &  ito) const

Fill a given set through the output iterator ito with the complement of this set in the domain.

Parameters
itothe output iterator
Template Parameters
TOutputIteratora model of output iterator
template<typename TMapImage>
const Domain& DGtal::DigitalSetFromMap< TMapImage >::domain ( ) const
Returns
the embedding domain.
template<typename TMapImage>
CowPtr<Domain> DGtal::DigitalSetFromMap< TMapImage >::domainPointer ( ) const
Returns
a counted pointer on the embedding domain.
template<typename TMapImage>
bool DGtal::DigitalSetFromMap< TMapImage >::empty ( ) const
Returns
'true' iff the set is empty (no element).
template<typename TMapImage>
ConstIterator DGtal::DigitalSetFromMap< TMapImage >::end ( ) const
Returns
a const iterator on the element after the last in this set.
template<typename TMapImage>
Iterator DGtal::DigitalSetFromMap< TMapImage >::end ( )
Returns
a iterator on the element after the last in this set.
template<typename TMapImage>
Size DGtal::DigitalSetFromMap< TMapImage >::erase ( const Point p)

Removes point [p] from the set.

Parameters
pthe point to remove.
Returns
the number of removed elements (0 or 1).
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::erase ( Iterator  it)

Removes the point pointed by [it] from the set.

Parameters
itan iterator on this set. Note: generally faster than giving just the point.
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::erase ( Iterator  first,
Iterator  last 
)

Removes the collection of points specified by the two iterators from this set.

Parameters
firstthe start point in this set.
lastthe last point in this set.
template<typename TMapImage>
ConstIterator DGtal::DigitalSetFromMap< TMapImage >::find ( const Point p) const
Parameters
pany digital point.
Returns
a constant iterator pointing on [p] if found, otherwise end().
template<typename TMapImage>
Iterator DGtal::DigitalSetFromMap< TMapImage >::find ( const Point p)
Parameters
pany digital point.
Returns
an iterator pointing on [p] if found, otherwise end().
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::insert ( const Point p)

Adds point [p] to this set.

Parameters
pany digital point.
Precondition
p should belong to the associated domain.
template<typename TMapImage>
template<typename PointInputIterator >
void DGtal::DigitalSetFromMap< TMapImage >::insert ( PointInputIterator  first,
PointInputIterator  last 
)

Adds the collection of points specified by the two iterators to this set.

Parameters
firstthe start point in the collection of Point.
lastthe last point in the collection of Point.
Precondition
all points should belong to the associated domain.
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::insertNew ( const Point p)

Adds point [p] to this set if the point is not already in the set.

Parameters
pany digital point.
Precondition
p should belong to the associated domain.
p should not belong to this.
template<typename TMapImage>
template<typename PointInputIterator >
void DGtal::DigitalSetFromMap< TMapImage >::insertNew ( PointInputIterator  first,
PointInputIterator  last 
)

Adds the collection of points specified by the two iterators to this set.

Parameters
firstthe start point in the collection of Point.
lastthe last point in the collection of Point.
Precondition
all points should belong to the associated domain.
each point should not belong to this.
template<typename TMapImage>
bool DGtal::DigitalSetFromMap< TMapImage >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TMapImage>
bool DGtal::DigitalSetFromMap< TMapImage >::operator() ( const Point p) const
Parameters
pany point.
Returns
'true' if and only if p belongs to this set.
template<typename TMapImage>
template<typename TDigitalSet >
Self& DGtal::DigitalSetFromMap< TMapImage >::operator+= ( const TDigitalSet &  aSet)

set union to left.

Parameters
aSetany other set.
Template Parameters
TDigitalSeta model of digital set.
template<typename TMapImage>
DigitalSetFromMap& DGtal::DigitalSetFromMap< TMapImage >::operator= ( const DigitalSetFromMap< TMapImage > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TMapImage>
void DGtal::DigitalSetFromMap< TMapImage >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TMapImage>
Size DGtal::DigitalSetFromMap< TMapImage >::size ( ) const
Returns
the number of elements in the set.

Field Documentation

template<typename TMapImage>
Image::Value DGtal::DigitalSetFromMap< TMapImage >::myDefault
protected

Default value for point insertion

Definition at line 108 of file DigitalSetFromMap.h.

template<typename TMapImage>
Functor DGtal::DigitalSetFromMap< TMapImage >::myFun
protected

Functor transforming pairs point-value into points

Definition at line 103 of file DigitalSetFromMap.h.

template<typename TMapImage>
Image* DGtal::DigitalSetFromMap< TMapImage >::myImgPtr
protected

Aliasing pointer on the image

Definition at line 98 of file DigitalSetFromMap.h.


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