DGtal 1.3.0
Loading...
Searching...
No Matches
Image.h
1
17#pragma once
18
31#if defined(Image_RECURSES)
32#error Recursive header files inclusion detected in Image.h
33#else // defined(Image_RECURSES)
35#define Image_RECURSES
36
37#if !defined Image_h
39#define Image_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
45#include "DGtal/base/ConceptUtils.h"
46#include "DGtal/images/CImage.h"
47#include "DGtal/kernel/domains/CDomain.h"
48#include "DGtal/base/CowPtr.h"
49#include "DGtal/graph/CVertexMap.h"
51
52namespace DGtal
53{
55 // Template class Image
68 template < typename TImageContainer >
69 class Image
70 {
71
72 // ----------------------- Types ------------------------------
73
74 public:
75
79
83 typedef typename TImageContainer::Point Point;
84 typedef typename TImageContainer::Value Value;
86 typedef typename TImageContainer::Range Range;
88
91
92 // ----------------------- Standard services ------------------------------
93
94 public:
95
100#ifdef DEBUG_VERBOSE
101trace.warning() << "Image Ctor default "<<std::endl;
102#endif
103
104 };
105
110 Image(ImageContainer *anImageContainer):
111 myImagePointer(anImageContainer)
112 {
113#ifdef DEBUG_VERBOSE
114 trace.warning() << "Image Ctor fromPointer "<<std::endl;
115#endif
116 }
117
123 Image(const CowPtr<ImageContainer> &anImageContainerCowPointer):
124 myImagePointer(anImageContainerCowPointer)
125 {
126 #ifdef DEBUG_VERBOSE
127trace.warning() << "Image Ctor fromCow "<<std::endl;
128#endif
129 }
130
136 Image(const ImageContainer &other):
137 myImagePointer(new ImageContainer(other) )
138 {
139#ifdef DEBUG_VERBOSE
140trace.warning() << "Image Ctor fromConstRef "<<std::endl;
141#endif
142 }
143
144
150 Image(const Image &other):
152 {
153 #ifdef DEBUG_VERBOSE
154trace.warning() << "Image copy Ctor "<<std::endl;
155#endif
156 }
157
163 Image & operator= ( const Image & other )
164 {
165 #ifdef DEBUG_VERBOSE
166 trace.warning() << "Image assignment "<<std::endl;
167#endif
168 if (&other != this)
169 {
171 }
172 return *this;
173 }
174
175
181
182 // ----------------------- Interface --------------------------------------
183 public:
184
186
192 const Domain & domain() const
193 {
194 return myImagePointer->domain();
195 }
196
204 {
205 return myImagePointer->constRange();
206 }
207
215 {
216 return myImagePointer->range();
217 }
218
220
221
232 {
233 return myImagePointer->operator()(aPoint);
234 }
235
236
238
247 void setValue(const Point &aPoint, const Value &aValue)
248 {
250 }
251
252
253
255
260 void selfDisplay ( std::ostream & out ) const;
261
266 bool isValid() const
267 {
268 return (myImagePointer->isValid() );
269 }
270
271
277 {
278 return myImagePointer;
279 }
280
281 // ------------------------- Protected Datas ------------------------------
282 private:
283 // ------------------------- Private Datas --------------------------------
284 protected:
285
288
289
290 private:
291
292
293 // ------------------------- Internals ------------------------------------
294 private:
295
296 }; // end of class Image
297
298
305 template <typename T>
306 std::ostream&
307 operator<< ( std::ostream & out, const Image<T> & object );
308
309} // namespace DGtal
310
311
313// Includes inline functions.
314#include "DGtal/images/Image.ih"
315
316// //
318
319#endif // !defined Image_h
320
321#undef Image_RECURSES
322#endif // else defined(Image_RECURSES)
Aim: Copy on write shared pointer.
Definition: CowPtr.h:68
void setValue(const Point &aPoint, const Value &aValue)
const Domain & domain() const
std::vector< Value >::iterator OutputIterator
SimpleRandomAccessRangeFromPoint< ConstIterator, Iterator, DistanceFunctorFromPoint< Self > > Range
SimpleRandomAccessConstRangeFromPoint< ConstIterator, DistanceFunctorFromPoint< Self > > ConstRange
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
const Domain & domain() const
Definition: Image.h:192
TImageContainer::ConstRange ConstRange
Definition: Image.h:85
CowPtr< TImageContainer > ImagePointer
Pointer to the image container data.
Definition: Image.h:90
Image(const Image &other)
Definition: Image.h:150
Image(const CowPtr< ImageContainer > &anImageContainerCowPointer)
Definition: Image.h:123
Image & operator=(const Image &other)
Definition: Image.h:163
Value operator()(const Point &aPoint) const
Definition: Image.h:231
Range range()
Definition: Image.h:214
Image(ImageContainer *anImageContainer)
Definition: Image.h:110
const ImagePointer getPointer() const
Definition: Image.h:276
ConstRange constRange() const
Definition: Image.h:203
void selfDisplay(std::ostream &out) const
TImageContainer::Point Point
Definition: Image.h:83
void setValue(const Point &aPoint, const Value &aValue)
Definition: Image.h:247
Image(const ImageContainer &other)
Definition: Image.h:136
TImageContainer ImageContainer
Types copied from the container.
Definition: Image.h:81
BOOST_CONCEPT_ASSERT((concepts::CImage< TImageContainer >))
Checking concepts.
TImageContainer::Domain Domain
Definition: Image.h:82
ImagePointer myImagePointer
Owning smart pointer on the image container.
Definition: Image.h:287
TImageContainer::Value Value
Definition: Image.h:84
bool isValid() const
Definition: Image.h:266
BOOST_CONCEPT_ASSERT((concepts::CVertexMap< TImageContainer >))
TImageContainer::Range Range
Definition: Image.h:86
TImageContainer::OutputIterator OutputIterator
Definition: Image.h:87
std::ostream & warning()
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Trace trace
Definition: Common.h:154
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:103
Aim: models of CVertexMap concept implement mapping between graph vertices and values.
Definition: CVertexMap.h:98
const Point aPoint(3, 4)