DGtal  1.4.beta
exampleIteratorCompletion.cpp File Reference

An example file for IteratorCompletion. More...

#include <new>
#include <cstddef>
#include <algorithm>
#include <iostream>
#include <DGtal/base/Common.h>
#include <DGtal/base/IteratorCompletion.h>
#include <DGtal/kernel/domains/HyperRectDomain.h>
#include <DGtal/kernel/domains/Linearizer.h>
#include <DGtal/kernel/SpaceND.h>
#include <DGtal/images/CImage.h>
Include dependency graph for exampleIteratorCompletion.cpp:

Go to the source code of this file.

Namespaces

 DGtal
 DGtal is the top-level namespace which contains all DGtal functions and types.
 

Functions

int main ()
 [IteratorCompletionTraits] More...
 

Detailed Description

An example file for IteratorCompletion.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Roland Denis (rolan.nosp@m.d.de.nosp@m.nis@u.nosp@m.niv-.nosp@m.smb.f.nosp@m.r ) LAboratory of MAthematics - LAMA (CNRS, UMR 5127), University of Savoie, France
Date
2015/10/15

This file is part of the DGtal library.

Definition in file exampleIteratorCompletion.cpp.

Function Documentation

◆ main()

int main ( void  )

[IteratorCompletionTraits]

[UsageExample]

[UsageExample]

Definition at line 191 of file exampleIteratorCompletion.cpp.

192 {
193 
195  using namespace std;
196 
197  // Typedefs
198  typedef MyImage<double, 2> My2DImage;
199  typedef My2DImage::Value Value;
200  typedef My2DImage::Domain Domain;
201  typedef My2DImage::Point Point;
202 
203  // Checks CImage concept
204  BOOST_CONCEPT_ASSERT( (DGtal::concepts::CImage<My2DImage>) );
205 
206  // Construction
207  My2DImage image( Domain( Point(0,0), Point(2,3) ) );
208 
209  // Filling
210  Value i = 0;
211  for ( My2DImage::Iterator it = image.begin(), it_end = image.end() ; it != it_end; ++it )
212  {
213  *it = ++i;
214  }
215 
216  // Modifying a value
217  image.setValue( Point(1,1), -1 );
218 
219  // Forward reading using range
220  My2DImage::ConstRange range = image.constRange();
221  copy( range.begin(), range.end(), ostream_iterator<Value>( cout, " " ) );
222  cout << endl;
223 
224  // Backward reading using reverse iterators
225  copy( image.rbegin(), image.rend(), ostream_iterator<Value>( cout, " " ) );
226  cout << endl;
227 
229 
230 }
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:103
MyPointD Point
Definition: testClone2.cpp:383
Image image(domain)
Image::ConstRange ConstRange
HyperRectDomain< Space > Domain

References image().