32#include "DGtal/base/Common.h"
33#include "DGtal/helpers/StdDefs.h"
34#include "DGtal/images/ImageSelector.h"
35#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
36#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
37#include "DGtal/geometry/volumes/distance/ReverseDistanceTransformation.h"
38#include "DGtal/io/colormaps/HueShadeColorMap.h"
39#include "DGtal/kernel/sets/DigitalSetBySTLSet.h"
40#include "DGtal/io/boards/Board2D.h"
41#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
50template<
typename Image>
58 for (
unsigned int k = 0 ; k < nb; k++)
60 for (
unsigned int dim = 0;
dim < Image::dimension;
dim++)
64 input.setValue(p, value);
79 unsigned int nbok = 0;
90 for (
unsigned k = 0; k < 49; k++ )
94 image.setValue ( a, 128 );
100 Predicate aPredicate(image,0);
111 for (
unsigned int y = 2; y < 16; y++)
113 for (
unsigned int x = 2; x < 16; x++)
115 std::cout << (*it) <<
" ";
118 std::cout << std::endl;
123 RDT reverseDT(&dom,&dt,&l2power);
126 for(
unsigned int j=2; j<16; j++)
128 for(
unsigned int i=2; i<16; i++)
134 RDT::ConstRange::ConstIterator it2 = reverseDT.constRange().begin();
135 for (
unsigned int y = 2; y < 16; y++)
137 for (
unsigned int x = 2; x < 16; x++)
139 std::cout << (*it2) <<
" ";
142 std::cout << std::endl;
147 RDT::ConstRange::ConstIterator itrec = reverseDT.constRange().begin(), itend = reverseDT.constRange().end();
149 for( ; itrec != itend; ++itrec,++itinit)
151 ok = ok & ((*itinit) == 0);
157 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
158 <<
"ok" << std::endl;
161 nbok += (reverseDT.metricPtr()->exactDistanceRepresentation(
Z2i::Point(4,7),
Z2i::Point(5,7))==1) ? 1 : 0;
163 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
164 <<
"true == true" << std::endl;
167 nbok += (reverseDT(
Z2i::Point(4,7))==0) ? 1 : 0;
169 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
170 <<
"true == true" << std::endl;
177 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
178 <<
"true == true" << std::endl;
186 unsigned int nbok = 0;
197 for (
unsigned k = 0; k < 49; k++ )
199 a[0] = ( k / 7 ) + 5;
200 a[1] = ( k % 7 ) + 5;
201 image.setValue ( a, 128 );
207 Predicate aPredicate(image,0);
217 for (
unsigned int y = 2; y < 16; y++)
219 for (
unsigned int x = 2; x < 16; x++)
221 std::cout << (int)(*it) <<
" ";
224 std::cout << std::endl;
229 RDT reverseDT(&dom, &dt, &l1power);
233 for(
unsigned int j=2; j<16; j++)
235 for(
unsigned int i=2; i<16; i++)
241 RDT::ConstRange::ConstIterator it2 = reverseDT.constRange().begin();
242 for (
unsigned int y = 2; y < 16; y++)
244 for (
unsigned int x = 2; x < 16; x++)
246 std::cout << (int)(*it2) <<
" ";
249 std::cout << std::endl;
254 RDT::ConstRange::ConstIterator itrec = reverseDT.constRange().begin(), itend = reverseDT.constRange().end();
256 for( ; itrec != itend; ++itrec,++itinit)
258 ok = ok & ((*itinit) == 0);
262 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
263 <<
"true == true" << std::endl;
271int main(
int argc,
char** argv )
275 for (
int i = 0; i < argc; ++i )
282 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
Aim: implements weighted separable l_p metrics with exact predicates.
Aim: implements separable l_p metrics with exact predicates.
std::vector< Value >::const_iterator ConstIterator
Aim: implements association bewteen points lying in a digital domain and values.
void beginBlock(const std::string &keyword="")
Aim: Define a simple Foreground predicate thresholding image values given a single thresold....
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
void randomSeeds(Image &input, const unsigned int nb, const int value)