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
53
namespace
DGtal
54
{
55
56
58
// class DefaultConstImageRange
60
75
template
<
typename
TImage>
76
class
DefaultConstImageRange
77
{
78
79
80
// ------------------------- inner types --------------------------------
81
public
:
82
83
BOOST_CONCEPT_ASSERT
((
concepts::CTrivialConstImage<TImage>
));
84
typedef
typename
TImage::Domain
Domain
;
85
typedef
typename
TImage::Point
Point
;
86
typedef
typename
TImage::Value
Value
;
87
89
BOOST_CONCEPT_ASSERT
((
concepts::CDomain<Domain>
));
90
typedef
ConstIteratorAdapter<typename Domain::ConstIterator,TImage,Value>
ConstIterator
;
91
typedef
std::reverse_iterator<ConstIterator>
ConstReverseIterator
;
92
93
// ------------------------- standard services --------------------------------
94
100
DefaultConstImageRange
(
ConstAlias<TImage>
aImage )
101
:
myImagePtr
(&aImage) {}
102
107
DefaultConstImageRange
(
const
DefaultConstImageRange
& other )
108
:
myImagePtr
(other.
myImagePtr
) {}
109
115
DefaultConstImageRange
&
operator=
(
const
DefaultConstImageRange
& other )
116
{
117
if
(
this
!= &other )
118
{
119
myImagePtr
= other.
myImagePtr
;
120
}
121
return
*
this
;
122
}
123
127
~DefaultConstImageRange
() {}
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
151
ConstIterator
begin
()
const
{
152
Domain
d =
myImagePtr
->domain();
153
return
ConstIterator
( d.begin(), *
myImagePtr
);
154
}
155
161
ConstIterator
begin
(
const
Point
&
aPoint
)
const
{
162
Domain
d =
myImagePtr
->domain();
163
return
ConstIterator
( d.begin(
aPoint
), *
myImagePtr
);
164
}
165
170
ConstIterator
end
()
const
{
171
Domain
d =
myImagePtr
->domain();
172
return
ConstIterator
( d.end(), *
myImagePtr
);
173
}
174
179
ConstReverseIterator
rbegin
()
const
{
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
200
ConstReverseIterator
rend
()
const
{
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)
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition
ConstAlias.h:187
DGtal::ConstIteratorAdapter
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
Definition
ConstIteratorAdapter.h:88
DGtal::DefaultConstImageRange
Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterat...
Definition
DefaultConstImageRange.h:77
DGtal::DefaultConstImageRange::isValid
bool isValid() const
Definition
DefaultConstImageRange.h:133
DGtal::DefaultConstImageRange::end
ConstIterator end() const
Definition
DefaultConstImageRange.h:170
DGtal::DefaultConstImageRange::rend
ConstReverseIterator rend() const
Definition
DefaultConstImageRange.h:200
DGtal::DefaultConstImageRange::begin
ConstIterator begin() const
Definition
DefaultConstImageRange.h:151
DGtal::DefaultConstImageRange::ConstReverseIterator
std::reverse_iterator< ConstIterator > ConstReverseIterator
Definition
DefaultConstImageRange.h:91
DGtal::DefaultConstImageRange::operator=
DefaultConstImageRange & operator=(const DefaultConstImageRange &other)
Definition
DefaultConstImageRange.h:115
DGtal::DefaultConstImageRange::DefaultConstImageRange
DefaultConstImageRange(const DefaultConstImageRange &other)
Definition
DefaultConstImageRange.h:107
DGtal::DefaultConstImageRange::rbegin
ConstReverseIterator rbegin(const Point &aPoint) const
Definition
DefaultConstImageRange.h:188
DGtal::DefaultConstImageRange::myImagePtr
const TImage * myImagePtr
Definition
DefaultConstImageRange.h:142
DGtal::DefaultConstImageRange::ConstIterator
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
Definition
DefaultConstImageRange.h:90
DGtal::DefaultConstImageRange::rbegin
ConstReverseIterator rbegin() const
Definition
DefaultConstImageRange.h:179
DGtal::DefaultConstImageRange::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CTrivialConstImage< TImage >))
DGtal::DefaultConstImageRange::begin
ConstIterator begin(const Point &aPoint) const
Definition
DefaultConstImageRange.h:161
DGtal::DefaultConstImageRange::Value
TImage::Value Value
Definition
DefaultConstImageRange.h:86
DGtal::DefaultConstImageRange::Point
TImage::Point Point
Definition
DefaultConstImageRange.h:85
DGtal::DefaultConstImageRange::DefaultConstImageRange
DefaultConstImageRange(ConstAlias< TImage > aImage)
Definition
DefaultConstImageRange.h:100
DGtal::DefaultConstImageRange::Domain
TImage::Domain Domain
Definition
DefaultConstImageRange.h:84
DGtal::DefaultConstImageRange::~DefaultConstImageRange
~DefaultConstImageRange()
Definition
DefaultConstImageRange.h:127
DGtal::DefaultConstImageRange::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
constant iterator types
DGtal::HyperRectDomain_Iterator
Iterator for HyperRectDomain.
Definition
HyperRectDomain_Iterator.h:154
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::concepts::CDomain
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition
CDomain.h:130
DGtal::concepts::CTrivialConstImage
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition
CTrivialConstImage.h:89
aPoint
const Point aPoint(3, 4)
src
DGtal
images
DefaultConstImageRange.h
Generated on Mon Jun 10 2024 17:36:00 for DGtal by
1.11.0