DGtal  1.5.beta
DGtal::DefaultConstImageRange< TImage > Class Template Reference

Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterate over the values associated to its domain points (in a read-only as well as a write-only manner).
More...

#include <DGtal/images/DefaultConstImageRange.h>

Public Types

typedef TImage::Domain Domain
 
typedef TImage::Point Point
 
typedef TImage::Value Value
 
typedef ConstIteratorAdapter< typename Domain::ConstIterator, TImage, ValueConstIterator
 
typedef std::reverse_iterator< ConstIteratorConstReverseIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CTrivialConstImage< TImage >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CDomain< Domain >))
 constant iterator types More...
 
 DefaultConstImageRange (ConstAlias< TImage > aImage)
 
 DefaultConstImageRange (const DefaultConstImageRange &other)
 
DefaultConstImageRangeoperator= (const DefaultConstImageRange &other)
 
 ~DefaultConstImageRange ()
 
bool isValid () const
 
ConstIterator begin () const
 
ConstIterator begin (const Point &aPoint) const
 
ConstIterator end () const
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rbegin (const Point &aPoint) const
 
ConstReverseIterator rend () const
 

Private Attributes

const TImage * myImagePtr
 

Detailed Description

template<typename TImage>
class DGtal::DefaultConstImageRange< TImage >

Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterate over the values associated to its domain points (in a read-only as well as a write-only manner).

Template Parameters
TImagea model of CConstImage mapping points to values

NB: the underlying image is stored as an aliasing pointer in order to avoid copies. As a consequence the pointed object must exist and must not be deleted during the use of any instance of this class.

Definition at line 76 of file DefaultConstImageRange.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TImage >
typedef ConstIteratorAdapter<typename Domain::ConstIterator,TImage,Value> DGtal::DefaultConstImageRange< TImage >::ConstIterator

Definition at line 90 of file DefaultConstImageRange.h.

◆ ConstReverseIterator

template<typename TImage >
typedef std::reverse_iterator<ConstIterator> DGtal::DefaultConstImageRange< TImage >::ConstReverseIterator

Definition at line 91 of file DefaultConstImageRange.h.

◆ Domain

template<typename TImage >
typedef TImage::Domain DGtal::DefaultConstImageRange< TImage >::Domain

Definition at line 84 of file DefaultConstImageRange.h.

◆ Point

template<typename TImage >
typedef TImage::Point DGtal::DefaultConstImageRange< TImage >::Point

Definition at line 85 of file DefaultConstImageRange.h.

◆ Value

template<typename TImage >
typedef TImage::Value DGtal::DefaultConstImageRange< TImage >::Value

Definition at line 86 of file DefaultConstImageRange.h.

Constructor & Destructor Documentation

◆ DefaultConstImageRange() [1/2]

template<typename TImage >
DGtal::DefaultConstImageRange< TImage >::DefaultConstImageRange ( ConstAlias< TImage >  aImage)
inline

Standard constructor from an image.

Parameters
aImageany image.

Definition at line 100 of file DefaultConstImageRange.h.

101  : myImagePtr(&aImage) {}

◆ DefaultConstImageRange() [2/2]

template<typename TImage >
DGtal::DefaultConstImageRange< TImage >::DefaultConstImageRange ( const DefaultConstImageRange< TImage > &  other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 107 of file DefaultConstImageRange.h.

108  : myImagePtr(other.myImagePtr) {}

◆ ~DefaultConstImageRange()

template<typename TImage >
DGtal::DefaultConstImageRange< TImage >::~DefaultConstImageRange ( )
inline

Destructor. Does nothing.

Definition at line 127 of file DefaultConstImageRange.h.

127 {}

Member Function Documentation

◆ begin() [1/2]

template<typename TImage >
ConstIterator DGtal::DefaultConstImageRange< TImage >::begin ( ) const
inline

Iterator service.

Returns
begin iterator

Definition at line 151 of file DefaultConstImageRange.h.

151  {
152  Domain d = myImagePtr->domain();
153  return ConstIterator( d.begin(), *myImagePtr );
154  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
HyperRectDomain< Space > Domain

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

Referenced by DGtal::DefaultConstImageRange< TImage >::rend().

◆ begin() [2/2]

template<typename TImage >
ConstIterator DGtal::DefaultConstImageRange< TImage >::begin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
begin iterator

Definition at line 161 of file DefaultConstImageRange.h.

161  {
162  Domain d = myImagePtr->domain();
163  return ConstIterator( d.begin(aPoint), *myImagePtr );
164  }
const Point aPoint(3, 4)

References aPoint(), and DGtal::DefaultConstImageRange< TImage >::myImagePtr.

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TImage >
DGtal::DefaultConstImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< Domain >)  )

constant iterator types

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TImage >
DGtal::DefaultConstImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CTrivialConstImage< TImage >)  )

◆ end()

template<typename TImage >
ConstIterator DGtal::DefaultConstImageRange< TImage >::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 170 of file DefaultConstImageRange.h.

170  {
171  Domain d = myImagePtr->domain();
172  return ConstIterator( d.end(), *myImagePtr );
173  }

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

Referenced by DGtal::DefaultConstImageRange< TImage >::rbegin().

◆ isValid()

template<typename TImage >
bool DGtal::DefaultConstImageRange< TImage >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 133 of file DefaultConstImageRange.h.

133 { return true; }

◆ operator=()

template<typename TImage >
DefaultConstImageRange& DGtal::DefaultConstImageRange< TImage >::operator= ( const DefaultConstImageRange< TImage > &  other)
inline

Assignment.

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

Definition at line 115 of file DefaultConstImageRange.h.

116  {
117  if ( this != &other )
118  {
119  myImagePtr = other.myImagePtr;
120  }
121  return *this;
122  }

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

◆ rbegin() [1/2]

template<typename TImage >
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 179 of file DefaultConstImageRange.h.

179  {
180  return ConstReverseIterator(this->end());
181  }
std::reverse_iterator< ConstIterator > ConstReverseIterator

References DGtal::DefaultConstImageRange< TImage >::end().

◆ rbegin() [2/2]

template<typename TImage >
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rbegin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
rbegin iterator

Definition at line 188 of file DefaultConstImageRange.h.

188  {
189  Domain d = myImagePtr->domain();
190  typename Domain::ConstIterator itOnPts = d.begin(aPoint);
191  if ( itOnPts != d.end() ) ++itOnPts;
192  ConstIterator itOnVals( itOnPts, *myImagePtr );
193  return ConstReverseIterator( itOnVals );
194  }
MyDigitalSurface::ConstIterator ConstIterator

References aPoint(), and DGtal::DefaultConstImageRange< TImage >::myImagePtr.

◆ rend()

template<typename TImage >
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 200 of file DefaultConstImageRange.h.

200  {
201  return ConstReverseIterator(this->begin());
202  }

References DGtal::DefaultConstImageRange< TImage >::begin().

Field Documentation

◆ myImagePtr

template<typename TImage >
const TImage* DGtal::DefaultConstImageRange< TImage >::myImagePtr
private

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