36#include <DGtal/base/Common.h>
37#include <DGtal/base/IteratorCompletion.h>
38#include <DGtal/kernel/domains/HyperRectDomain.h>
39#include <DGtal/kernel/domains/Linearizer.h>
40#include <DGtal/kernel/SpaceND.h>
41#include <DGtal/images/CImage.h>
47template <
typename T, DGtal::Dimension N >
54 typedef MyImage<T, N> Self;
66 : myDomain(aDomain), myData( new T[ myDomain.size() ] )
82 return myData[ Linearizer::getIndex(
aPoint, myDomain) ];
94 myData[ Linearizer::getIndex(
aPoint, myDomain) ] = aValue;
98 Domain const& domain()
const
104 Self& operator= ( Self
const& other )
106 if (
this != &other )
108 myDomain = other.domain();
111 std::copy( other.begin(), other.end(), begin() );
136 return myData + myDomain.
size();
142 return myData + myDomain.
size();
159 template <
typename T, Dimension N >
160 class IteratorCompletionTraits< MyImage<T, N> >
163 typedef MyImage<T, N> Self;
167 class DistanceFunctor
170 typedef typename Self::Domain
Domain;
171 typedef typename Self::Point
Point;
172 typedef typename Self::Difference Difference;
174 DistanceFunctor( Self
const* aVector )
175 : myDomain(aVector->
domain())
178 Difference operator() (
Point const&
aPoint )
const
180 return Self::Linearizer::getIndex(
aPoint, myDomain );
198 typedef MyImage<double, 2> My2DImage;
199 typedef My2DImage::Value
Value;
200 typedef My2DImage::Domain
Domain;
201 typedef My2DImage::Point
Point;
211 for ( My2DImage::Iterator it = image.begin(), it_end = image.end() ; it != it_end; ++it )
217 image.setValue(
Point(1,1), -1 );
220 My2DImage::ConstRange range = image.constRange();
221 copy( range.begin(), range.end(), ostream_iterator<Value>( cout,
" " ) );
225 copy( image.rbegin(), image.rend(), ostream_iterator<Value>( cout,
" " ) );
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: Traits that must be specialized for each IteratorCompletion derived class.
Aim: Class that uses CRTP to add reverse iterators and ranges to a derived class.
PointVector< dim, Integer > Point
Points in DGtal::SpaceND.
int main()
[IteratorCompletionTraits]
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Linearization and de-linearization interface for domains.
Aim: Defines the concept describing a read/write image, having an output iterator.
Linearizer< Domain, ColMajorStorage > Linearizer
HyperRectDomain< Space > Domain