DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::DefaultImageRange< TImage > Class Template Reference

#include <DGtal/images/DefaultImageRange.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
 
typedef SetValueIterator< TImage > OutputIterator
 
typedef SetValueIterator< TImage, typename Domain::ConstReverseIteratorReverseOutputIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CTrivialImage< TImage >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CDomain< Domain >))
 
 DefaultImageRange (TImage &aImage)
 
 DefaultImageRange (const DefaultImageRange &other)
 
DefaultImageRangeoperator= (const DefaultImageRange &other)
 
 ~DefaultImageRange ()
 
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
 
OutputIterator outputIterator () const
 
OutputIterator outputIterator (const Point &aPoint) const
 
ReverseOutputIterator routputIterator () const
 
ReverseOutputIterator routputIterator (const Point &aPoint) const
 

Private Attributes

TImage * myImagePtr
 

Detailed Description

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

Aim: model of CConstBidirectionalRangeFromPoint and CBidirectionalRangeWithWritableIteratorFromPoint 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 CImage 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.

TODO: inherits from DefaultConstImageRange

Definition at line 76 of file DefaultImageRange.h.

Member Typedef Documentation

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

Definition at line 90 of file DefaultImageRange.h.

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

Definition at line 91 of file DefaultImageRange.h.

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

Definition at line 84 of file DefaultImageRange.h.

template<typename TImage >
typedef SetValueIterator<TImage> DGtal::DefaultImageRange< TImage >::OutputIterator

output iterator types

Definition at line 94 of file DefaultImageRange.h.

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

Definition at line 85 of file DefaultImageRange.h.

template<typename TImage >
typedef SetValueIterator<TImage, typename Domain::ConstReverseIterator> DGtal::DefaultImageRange< TImage >::ReverseOutputIterator

Definition at line 95 of file DefaultImageRange.h.

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

Definition at line 86 of file DefaultImageRange.h.

Constructor & Destructor Documentation

template<typename TImage >
DGtal::DefaultImageRange< TImage >::DefaultImageRange ( TImage &  aImage)
inline

Standard constructor from an image.

Parameters
aImageany image.

Definition at line 104 of file DefaultImageRange.h.

105  : myImagePtr(&aImage) {}
template<typename TImage >
DGtal::DefaultImageRange< TImage >::DefaultImageRange ( const DefaultImageRange< TImage > &  other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 111 of file DefaultImageRange.h.

112  : myImagePtr(other.myImagePtr) {}
template<typename TImage >
DGtal::DefaultImageRange< TImage >::~DefaultImageRange ( )
inline

Destructor. Does nothing.

Definition at line 131 of file DefaultImageRange.h.

131 {}

Member Function Documentation

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

Iterator service.

Returns
begin iterator

Definition at line 155 of file DefaultImageRange.h.

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

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

155  {
156  Domain d = myImagePtr->domain();
157  return ConstIterator( d.begin(), *myImagePtr );
158  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage >
ConstIterator DGtal::DefaultImageRange< TImage >::begin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
begin iterator

Definition at line 165 of file DefaultImageRange.h.

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

165  {
166  Domain d = myImagePtr->domain();
167  return ConstIterator( d.begin(aPoint), *myImagePtr );
168  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage >
DGtal::DefaultImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CTrivialImage< TImage >)  )
template<typename TImage >
DGtal::DefaultImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< Domain >)  )

constant iterator types

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

Iterator service.

Returns
end iterator

Definition at line 174 of file DefaultImageRange.h.

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

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

174  {
175  Domain d = myImagePtr->domain();
176  return ConstIterator( d.end(), *myImagePtr );
177  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage >
bool DGtal::DefaultImageRange< TImage >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 137 of file DefaultImageRange.h.

137 { return true; }
template<typename TImage >
DefaultImageRange& DGtal::DefaultImageRange< TImage >::operator= ( const DefaultImageRange< TImage > &  other)
inline

Assignment.

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

Definition at line 119 of file DefaultImageRange.h.

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

120  {
121  if ( this != &other )
122  {
123  myImagePtr = other.myImagePtr;
124  }
125  return *this;
126  }
template<typename TImage >
OutputIterator DGtal::DefaultImageRange< TImage >::outputIterator ( ) const
inline

Iterator service.

Returns
output iterator

Definition at line 214 of file DefaultImageRange.h.

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

214  {
215  Domain d = myImagePtr->domain();
216  return OutputIterator( d.begin(), *myImagePtr );
217  }
SetValueIterator< TImage > OutputIterator
output iterator types
template<typename TImage >
OutputIterator DGtal::DefaultImageRange< TImage >::outputIterator ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
output iterator

Definition at line 224 of file DefaultImageRange.h.

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

224  {
225  Domain d = myImagePtr->domain();
226  return OutputIterator( d.begin(aPoint), *myImagePtr );
227  }
SetValueIterator< TImage > OutputIterator
output iterator types
template<typename TImage >
ConstReverseIterator DGtal::DefaultImageRange< TImage >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 183 of file DefaultImageRange.h.

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

183  {
184  return ConstReverseIterator(this->end());
185  }
ConstIterator end() const
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TImage >
ConstReverseIterator DGtal::DefaultImageRange< TImage >::rbegin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
rbegin iterator

Definition at line 192 of file DefaultImageRange.h.

192  {
193  Domain d = myImagePtr->domain();
194  typename Domain::ConstIterator itOnPts = d.begin(aPoint);
195  if ( itOnPts != d.end() ) ++itOnPts;
196  ConstIterator itOnVals( itOnPts, *myImagePtr );
197  return ConstReverseIterator( itOnVals );
198  }
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TImage >
ConstReverseIterator DGtal::DefaultImageRange< TImage >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 204 of file DefaultImageRange.h.

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

204  {
205  return ConstReverseIterator(this->begin());
206  }
ConstIterator begin() const
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TImage >
ReverseOutputIterator DGtal::DefaultImageRange< TImage >::routputIterator ( ) const
inline

Iterator service.

Returns
reverse output iterator

Definition at line 233 of file DefaultImageRange.h.

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

233  {
234  Domain d = myImagePtr->domain();
235  return ReverseOutputIterator( d.rbegin(), *myImagePtr );
236  }
SetValueIterator< TImage, typename Domain::ConstReverseIterator > ReverseOutputIterator
template<typename TImage >
ReverseOutputIterator DGtal::DefaultImageRange< TImage >::routputIterator ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
reverse output iterator

Definition at line 243 of file DefaultImageRange.h.

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

243  {
244  Domain d = myImagePtr->domain();
245  return ReverseOutputIterator( d.rbegin(aPoint), *myImagePtr );
246  }
SetValueIterator< TImage, typename Domain::ConstReverseIterator > ReverseOutputIterator

Field Documentation

template<typename TImage >
TImage* DGtal::DefaultImageRange< TImage >::myImagePtr
private

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