DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::DefaultImageRange< TImage > Class Template Reference

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

#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
 output iterator types More...
 
typedef SetValueIterator< TImage, typename Domain::ConstReverseIteratorReverseOutputIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CTrivialImage< TImage >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CDomain< Domain >))
 constant iterator types More...
 
 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

◆ ConstIterator

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

Definition at line 90 of file DefaultImageRange.h.

◆ ConstReverseIterator

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

Definition at line 91 of file DefaultImageRange.h.

◆ Domain

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

Definition at line 84 of file DefaultImageRange.h.

◆ OutputIterator

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

output iterator types

Definition at line 94 of file DefaultImageRange.h.

◆ Point

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

Definition at line 85 of file DefaultImageRange.h.

◆ ReverseOutputIterator

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

Definition at line 95 of file DefaultImageRange.h.

◆ Value

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

Definition at line 86 of file DefaultImageRange.h.

Constructor & Destructor Documentation

◆ DefaultImageRange() [1/2]

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) {}

◆ DefaultImageRange() [2/2]

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) {}

◆ ~DefaultImageRange()

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

Destructor. Does nothing.

Definition at line 131 of file DefaultImageRange.h.

131{}

Member Function Documentation

◆ begin() [1/2]

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

Iterator service.

Returns
begin iterator

Definition at line 155 of file DefaultImageRange.h.

155 {
156 Domain d = myImagePtr->domain();
157 return ConstIterator( d.begin(), *myImagePtr );
158 }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
HyperRectDomain< Space > Domain

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

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

◆ begin() [2/2]

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.

165 {
166 Domain d = myImagePtr->domain();
167 return ConstIterator( d.begin(aPoint), *myImagePtr );
168 }
const Point aPoint(3, 4)

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

◆ BOOST_CONCEPT_ASSERT() [1/2]

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

constant iterator types

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TImage >
DGtal::DefaultImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CTrivialImage< TImage >)  )

◆ end()

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

Iterator service.

Returns
end iterator

Definition at line 174 of file DefaultImageRange.h.

174 {
175 Domain d = myImagePtr->domain();
176 return ConstIterator( d.end(), *myImagePtr );
177 }

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

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

◆ isValid()

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; }

◆ operator=()

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.

120 {
121 if ( this != &other )
122 {
123 myImagePtr = other.myImagePtr;
124 }
125 return *this;
126 }

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

◆ outputIterator() [1/2]

template<typename TImage >
OutputIterator DGtal::DefaultImageRange< TImage >::outputIterator ( ) const
inline

Iterator service.

Returns
output iterator

Definition at line 214 of file DefaultImageRange.h.

214 {
215 Domain d = myImagePtr->domain();
216 return OutputIterator( d.begin(), *myImagePtr );
217 }
SetValueIterator< TImage > OutputIterator
output iterator types

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

◆ outputIterator() [2/2]

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.

224 {
225 Domain d = myImagePtr->domain();
226 return OutputIterator( d.begin(aPoint), *myImagePtr );
227 }

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

◆ rbegin() [1/2]

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

Iterator service.

Returns
rbegin iterator

Definition at line 183 of file DefaultImageRange.h.

183 {
184 return ConstReverseIterator(this->end());
185 }
std::reverse_iterator< ConstIterator > ConstReverseIterator
ConstIterator end() const

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

◆ rbegin() [2/2]

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 }
MyDigitalSurface::ConstIterator ConstIterator

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

◆ rend()

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

Iterator service.

Returns
rend iterator

Definition at line 204 of file DefaultImageRange.h.

204 {
205 return ConstReverseIterator(this->begin());
206 }
ConstIterator begin() const

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

◆ routputIterator() [1/2]

template<typename TImage >
ReverseOutputIterator DGtal::DefaultImageRange< TImage >::routputIterator ( ) const
inline

Iterator service.

Returns
reverse output iterator

Definition at line 233 of file DefaultImageRange.h.

233 {
234 Domain d = myImagePtr->domain();
235 return ReverseOutputIterator( d.rbegin(), *myImagePtr );
236 }
SetValueIterator< TImage, typename Domain::ConstReverseIterator > ReverseOutputIterator

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

◆ routputIterator() [2/2]

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.

243 {
244 Domain d = myImagePtr->domain();
245 return ReverseOutputIterator( d.rbegin(aPoint), *myImagePtr );
246 }

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

Field Documentation

◆ myImagePtr

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

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