38#include "DGtal/base/Common.h"
39#include "DGtal/helpers/StdDefs.h"
40#include "ConfigTest.h"
42#include "DGtal/base/BasicFunctors.h"
43#include "DGtal/images/ImageSelector.h"
44#include "DGtal/images/ConstImageAdapter.h"
54 typedef typename R::ConstIterator I;
55 for (I it = r.begin(), itEnd = r.end();
58 trace.info() << *it <<
" ";
60 trace.info() << std::endl;
64int main(
int argc,
char** argv )
66 unsigned int nbok = 0;
69 trace.beginBlock (
"Test for ConstImageAdapter" );
70 trace.info() <<
"Args:";
71 for (
int i = 0; i < argc; ++i )
72 trace.info() <<
" " << argv[ i ];
77 trace.beginBlock(
"Image creation");
81 Point p = Point::diagonal(0);
82 Point q = Point::diagonal(size-1);
90 const int maximalValue = size*size;
92 for (
int i = 0; i < maximalValue; ++i)
97 std::copy( r.
begin(), r.
end(), std::ostream_iterator<int>(cout,
", ") );
102 const int thresholdValue = maximalValue/2;
103 trace.beginBlock(
"Implicit thresholding");
110 MyConstImageAdapter a(img, d, g, t);
117 std::copy( ra.begin(), ra.end(), std::ostream_iterator<int>(cout,
", ") );
120 std::vector<int> to_vector(25);
121 std::copy(ra.begin(), ra.end(), to_vector.begin());
122 for (
int i = 0; i < 25; i++)
157 bool res = (nbok == nb);
159 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
64int main(
int argc,
char** argv ) {
…}
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
std::vector< Value >::iterator OutputIterator
SimpleRandomAccessConstRangeFromPoint< ConstIterator, DistanceFunctorFromPoint< Self > > ConstRange
Aim: implements association bewteen points lying in a digital domain and values.
ConstRange constRange() const
ConstIterator begin() const
ConstIterator end() const
OutputIterator outputIterator()
Aim: A small functor with an operator () that compares one value to a threshold value according to tw...
Point::Coordinate Integer
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
ImageContainerBySTLVector< Domain, Value > Type
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Aim: Define a simple default functor that just returns its argument.
void displayRange(const R &r)
Image::ConstRange ConstRange