DGtal
1.4.2
Loading...
Searching...
No Matches
DefaultImageRange.h
1
17
#pragma once
18
33
#if defined(DefaultImageRange_RECURSES)
34
#error Recursive header files inclusion detected in DefaultImageRange.h
35
#else
// defined(DefaultImageRange_RECURSES)
37
#define DefaultImageRange_RECURSES
38
39
#if !defined DefaultImageRange_h
41
#define DefaultImageRange_h
42
44
// Inclusions
45
#include "DGtal/base/ConstIteratorAdapter.h"
46
#include "DGtal/kernel/domains/CDomain.h"
47
#include "DGtal/images/CTrivialImage.h"
48
#include "DGtal/images/SetValueIterator.h"
49
#include "boost/concept_check.hpp"
51
52
namespace
DGtal
53
{
54
55
57
// class DefaultImageRange
59
75
template
<
typename
TImage>
76
class
DefaultImageRange
77
{
78
79
80
// ------------------------- inner types --------------------------------
81
public
:
82
83
BOOST_CONCEPT_ASSERT
((
concepts::CTrivialImage<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
94
typedef
SetValueIterator<TImage>
OutputIterator
;
95
typedef
SetValueIterator<TImage, typename Domain::ConstReverseIterator>
ReverseOutputIterator
;
96
97
// ------------------------- standard services --------------------------------
98
104
DefaultImageRange
( TImage& aImage )
105
:
myImagePtr
(&aImage) {}
106
111
DefaultImageRange
(
const
DefaultImageRange
& other )
112
:
myImagePtr
(other.
myImagePtr
) {}
113
119
DefaultImageRange
&
operator=
(
const
DefaultImageRange
& other )
120
{
121
if
(
this
!= &other )
122
{
123
myImagePtr
= other.
myImagePtr
;
124
}
125
return
*
this
;
126
}
127
131
~DefaultImageRange
() {}
132
137
bool
isValid
()
const
{
return
true
; }
138
139
140
141
// ------------------------- private data --------------------------------
142
private
:
146
TImage*
myImagePtr
;
147
148
// ------------------------- iterator services (read-only) --------------------------------
149
public
:
150
155
ConstIterator
begin
()
const
{
156
Domain
d =
myImagePtr
->domain();
157
return
ConstIterator
( d.begin(), *
myImagePtr
);
158
}
159
165
ConstIterator
begin
(
const
Point
&
aPoint
)
const
{
166
Domain
d =
myImagePtr
->domain();
167
return
ConstIterator
( d.begin(
aPoint
), *
myImagePtr
);
168
}
169
174
ConstIterator
end
()
const
{
175
Domain
d =
myImagePtr
->domain();
176
return
ConstIterator
( d.end(), *
myImagePtr
);
177
}
178
183
ConstReverseIterator
rbegin
()
const
{
184
return
ConstReverseIterator
(this->
end
());
185
}
186
192
ConstReverseIterator
rbegin
(
const
Point
&
aPoint
)
const
{
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
}
199
204
ConstReverseIterator
rend
()
const
{
205
return
ConstReverseIterator
(this->
begin
());
206
}
207
208
// ------------------------- iterator services (write-only) --------------------------------
209
public
:
214
OutputIterator
outputIterator
()
const
{
215
Domain
d =
myImagePtr
->domain();
216
return
OutputIterator
( d.begin(), *
myImagePtr
);
217
}
218
224
OutputIterator
outputIterator
(
const
Point
&
aPoint
)
const
{
225
Domain
d =
myImagePtr
->domain();
226
return
OutputIterator
( d.begin(
aPoint
), *
myImagePtr
);
227
}
228
233
ReverseOutputIterator
routputIterator
()
const
{
234
Domain
d =
myImagePtr
->domain();
235
return
ReverseOutputIterator
( d.rbegin(), *
myImagePtr
);
236
}
237
243
ReverseOutputIterator
routputIterator
(
const
Point
&
aPoint
)
const
{
244
Domain
d =
myImagePtr
->domain();
245
return
ReverseOutputIterator
( d.rbegin(
aPoint
), *
myImagePtr
);
246
}
247
248
};
//end class DefaultImageRange
249
250
}
// namespace DGtal
251
253
254
255
#endif
// !defined DefaultImageRange_h
256
257
#undef DefaultImageRange_RECURSES
258
#endif
// else defined(DefaultImageRange_RECURSES)
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::DefaultImageRange
Aim: model of CConstBidirectionalRangeFromPoint and CBidirectionalRangeWithWritableIteratorFromPoint ...
Definition
DefaultImageRange.h:77
DGtal::DefaultImageRange::ConstReverseIterator
std::reverse_iterator< ConstIterator > ConstReverseIterator
Definition
DefaultImageRange.h:91
DGtal::DefaultImageRange::ReverseOutputIterator
SetValueIterator< TImage, typename Domain::ConstReverseIterator > ReverseOutputIterator
Definition
DefaultImageRange.h:95
DGtal::DefaultImageRange::~DefaultImageRange
~DefaultImageRange()
Definition
DefaultImageRange.h:131
DGtal::DefaultImageRange::Domain
TImage::Domain Domain
Definition
DefaultImageRange.h:84
DGtal::DefaultImageRange::Point
TImage::Point Point
Definition
DefaultImageRange.h:85
DGtal::DefaultImageRange::routputIterator
ReverseOutputIterator routputIterator() const
Definition
DefaultImageRange.h:233
DGtal::DefaultImageRange::DefaultImageRange
DefaultImageRange(TImage &aImage)
Definition
DefaultImageRange.h:104
DGtal::DefaultImageRange::outputIterator
OutputIterator outputIterator() const
Definition
DefaultImageRange.h:214
DGtal::DefaultImageRange::Value
TImage::Value Value
Definition
DefaultImageRange.h:86
DGtal::DefaultImageRange::rend
ConstReverseIterator rend() const
Definition
DefaultImageRange.h:204
DGtal::DefaultImageRange::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
constant iterator types
DGtal::DefaultImageRange::rbegin
ConstReverseIterator rbegin() const
Definition
DefaultImageRange.h:183
DGtal::DefaultImageRange::myImagePtr
TImage * myImagePtr
Definition
DefaultImageRange.h:146
DGtal::DefaultImageRange::ConstIterator
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
Definition
DefaultImageRange.h:90
DGtal::DefaultImageRange::begin
ConstIterator begin() const
Definition
DefaultImageRange.h:155
DGtal::DefaultImageRange::routputIterator
ReverseOutputIterator routputIterator(const Point &aPoint) const
Definition
DefaultImageRange.h:243
DGtal::DefaultImageRange::DefaultImageRange
DefaultImageRange(const DefaultImageRange &other)
Definition
DefaultImageRange.h:111
DGtal::DefaultImageRange::rbegin
ConstReverseIterator rbegin(const Point &aPoint) const
Definition
DefaultImageRange.h:192
DGtal::DefaultImageRange::outputIterator
OutputIterator outputIterator(const Point &aPoint) const
Definition
DefaultImageRange.h:224
DGtal::DefaultImageRange::OutputIterator
SetValueIterator< TImage > OutputIterator
output iterator types
Definition
DefaultImageRange.h:94
DGtal::DefaultImageRange::end
ConstIterator end() const
Definition
DefaultImageRange.h:174
DGtal::DefaultImageRange::operator=
DefaultImageRange & operator=(const DefaultImageRange &other)
Definition
DefaultImageRange.h:119
DGtal::DefaultImageRange::begin
ConstIterator begin(const Point &aPoint) const
Definition
DefaultImageRange.h:165
DGtal::DefaultImageRange::isValid
bool isValid() const
Definition
DefaultImageRange.h:137
DGtal::DefaultImageRange::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CTrivialImage< TImage >))
DGtal::HyperRectDomain_Iterator
Iterator for HyperRectDomain.
Definition
HyperRectDomain_Iterator.h:154
DGtal::SetValueIterator
Aim: implements an output iterator, which is able to write values in an underlying image,...
Definition
SetValueIterator.h:68
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::CTrivialImage
Aim: Defines the concept describing an image without extra ranges, which is a refinement of CTrivialC...
Definition
CTrivialImage.h:85
aPoint
const Point aPoint(3, 4)
src
DGtal
images
DefaultImageRange.h
Generated on Mon Dec 23 2024 11:13:32 for DGtal by
1.12.0