DGtal  1.5.beta
DGtal::DigitalSetFromMap< TMapImage > Class Template Reference

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.
More...

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

Public Types

typedef TMapImage Image
 
typedef Image Container
 
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 ()
 
const Containercontainer () const
 
Containercontainer ()
 
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

Definition at line 74 of file DigitalSetFromMap.h.

Member Typedef Documentation

◆ ConstIterator

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

Definition at line 90 of file DigitalSetFromMap.h.

◆ Container

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

Definition at line 79 of file DigitalSetFromMap.h.

◆ Domain

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

Definition at line 85 of file DigitalSetFromMap.h.

◆ Functor

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

Definition at line 89 of file DigitalSetFromMap.h.

◆ Image

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

Definition at line 78 of file DigitalSetFromMap.h.

◆ Iterator

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

Definition at line 91 of file DigitalSetFromMap.h.

◆ Pair

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

Definition at line 81 of file DigitalSetFromMap.h.

◆ Point

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

Definition at line 86 of file DigitalSetFromMap.h.

◆ Self

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

Definition at line 82 of file DigitalSetFromMap.h.

◆ Size

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

Definition at line 87 of file DigitalSetFromMap.h.

Constructor & Destructor Documentation

◆ ~DigitalSetFromMap()

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

Destructor.

◆ DigitalSetFromMap() [1/3]

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).

◆ DigitalSetFromMap() [2/3]

template<typename TMapImage >
DGtal::DigitalSetFromMap< TMapImage >::DigitalSetFromMap ( const DigitalSetFromMap< TMapImage > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ DigitalSetFromMap() [3/3]

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

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

Member Function Documentation

◆ assignFromComplement()

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.

◆ begin() [1/2]

template<typename TMapImage >
Iterator DGtal::DigitalSetFromMap< TMapImage >::begin ( )
Returns
an iterator on the first element in this set.

◆ begin() [2/2]

template<typename TMapImage >
ConstIterator DGtal::DigitalSetFromMap< TMapImage >::begin ( ) const
Returns
a const iterator on the first element in this set.

◆ className()

template<typename TMapImage >
std::string DGtal::DigitalSetFromMap< TMapImage >::className ( ) const
Returns
the style name used for drawing this object.

◆ clear()

template<typename TMapImage >
void DGtal::DigitalSetFromMap< TMapImage >::clear ( )

Clears the set.

Postcondition
this set is empty.

◆ computeBoundingBox()

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).

◆ computeComplement()

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

◆ container() [1/2]

template<typename TMapImage >
Container& DGtal::DigitalSetFromMap< TMapImage >::container ( )
inline

Give access to the underlying container.

Returns
a (might be const) reference to the stored container.

Definition at line 282 of file DigitalSetFromMap.h.

282 { return *myImgPtr;};

References DGtal::DigitalSetFromMap< TMapImage >::myImgPtr.

◆ container() [2/2]

template<typename TMapImage >
const Container& DGtal::DigitalSetFromMap< TMapImage >::container ( ) const
inline

Give access to the underlying container.

Returns
a (might be const) reference to the stored container.

Definition at line 277 of file DigitalSetFromMap.h.

277 { return *myImgPtr;};

References DGtal::DigitalSetFromMap< TMapImage >::myImgPtr.

◆ domain()

template<typename TMapImage >
const Domain& DGtal::DigitalSetFromMap< TMapImage >::domain ( ) const
Returns
the embedding domain.

◆ domainPointer()

template<typename TMapImage >
CowPtr<Domain> DGtal::DigitalSetFromMap< TMapImage >::domainPointer ( ) const
Returns
a counted pointer on the embedding domain.

◆ empty()

template<typename TMapImage >
bool DGtal::DigitalSetFromMap< TMapImage >::empty ( ) const
Returns
'true' iff the set is empty (no element).

◆ end() [1/2]

template<typename TMapImage >
Iterator DGtal::DigitalSetFromMap< TMapImage >::end ( )
Returns
a iterator on the element after the last in this set.

◆ end() [2/2]

template<typename TMapImage >
ConstIterator DGtal::DigitalSetFromMap< TMapImage >::end ( ) const
Returns
a const iterator on the element after the last in this set.

◆ erase() [1/3]

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).

◆ erase() [2/3]

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.

◆ erase() [3/3]

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.

◆ find() [1/2]

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().

◆ find() [2/2]

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().

◆ insert() [1/2]

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.

◆ insert() [2/2]

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.

◆ insertNew() [1/2]

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.

◆ insertNew() [2/2]

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.

◆ isValid()

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.

◆ operator()()

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.

◆ operator+=()

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.

◆ operator=()

template<typename TMapImage >
DigitalSetFromMap& DGtal::DigitalSetFromMap< TMapImage >::operator= ( const DigitalSetFromMap< TMapImage > &  other)

Assignment.

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

◆ selfDisplay()

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.

◆ size()

template<typename TMapImage >
Size DGtal::DigitalSetFromMap< TMapImage >::size ( ) const
Returns
the number of elements in the set.

Field Documentation

◆ myDefault

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

Default value for point insertion

Definition at line 109 of file DigitalSetFromMap.h.

◆ myFun

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

Functor transforming pairs point-value into points

Definition at line 104 of file DigitalSetFromMap.h.

◆ myImgPtr

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

Aliasing pointer on the image

Definition at line 99 of file DigitalSetFromMap.h.

Referenced by DGtal::DigitalSetFromMap< TMapImage >::container().


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