DGtal 1.4.0
Loading...
Searching...
No Matches
DefaultConstImageRange.h
1
17#pragma once
18
33#if defined(DefaultConstImageRange_RECURSES)
34#error Recursive header files inclusion detected in DefaultConstImageRange.h
35#else // defined(DefaultConstImageRange_RECURSES)
37#define DefaultConstImageRange_RECURSES
38
39#if !defined DefaultConstImageRange_h
41#define DefaultConstImageRange_h
42
44// Inclusions
45#include "DGtal/base/ConstIteratorAdapter.h"
46#include "DGtal/base/ConstAlias.h"
47#include "DGtal/kernel/domains/CDomain.h"
48#include "DGtal/images/CTrivialConstImage.h"
49#include "DGtal/images/SetValueIterator.h"
50#include "boost/concept_check.hpp"
52
53namespace DGtal
54{
55
56
58 // class DefaultConstImageRange
60
75 template <typename TImage>
77 {
78
79
80 // ------------------------- inner types --------------------------------
81 public:
82
84 typedef typename TImage::Domain Domain;
85 typedef typename TImage::Point Point;
86 typedef typename TImage::Value Value;
87
91 typedef std::reverse_iterator<ConstIterator> ConstReverseIterator;
92
93 // ------------------------- standard services --------------------------------
94
102
109
116 {
117 if ( this != &other )
118 {
119 myImagePtr = other.myImagePtr;
120 }
121 return *this;
122 }
123
128
133 bool isValid() const { return true; }
134
135
136
137 // ------------------------- private data --------------------------------
138 private:
142 const TImage* myImagePtr;
143
144 // ------------------------- iterator services (read-only) --------------------------------
145 public:
146
152 Domain d = myImagePtr->domain();
153 return ConstIterator( d.begin(), *myImagePtr );
154 }
155
162 Domain d = myImagePtr->domain();
163 return ConstIterator( d.begin(aPoint), *myImagePtr );
164 }
165
171 Domain d = myImagePtr->domain();
172 return ConstIterator( d.end(), *myImagePtr );
173 }
174
180 return ConstReverseIterator(this->end());
181 }
182
188 ConstReverseIterator rbegin(const Point& aPoint) const {
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 }
195
201 return ConstReverseIterator(this->begin());
202 }
203
204
205 }; //end class DefaultConstImageRange
206
207} // namespace DGtal
208
210
211
212#endif // !defined DefaultConstImageRange_h
213
214#undef DefaultConstImageRange_RECURSES
215#endif // else defined(DefaultConstImageRange_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition ConstAlias.h:187
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterat...
ConstReverseIterator rend() const
std::reverse_iterator< ConstIterator > ConstReverseIterator
DefaultConstImageRange & operator=(const DefaultConstImageRange &other)
DefaultConstImageRange(const DefaultConstImageRange &other)
ConstReverseIterator rbegin(const Point &aPoint) const
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
ConstReverseIterator rbegin() const
BOOST_CONCEPT_ASSERT((concepts::CTrivialConstImage< TImage >))
ConstIterator begin(const Point &aPoint) const
DefaultConstImageRange(ConstAlias< TImage > aImage)
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
constant iterator types
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition CDomain.h:130
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
const Point aPoint(3, 4)