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
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France
- Date
- 2012/06/18
Functions for testing objects as graph.
This file is part of the DGtal library.
Definition in file testDistancePropagation.cpp.
bool testDistancePropagation |
( |
| ) |
|
Definition at line 57 of file testDistancePropagation.cpp.
84 Object obj(Z2i::dt4_8, shape_set);
88 cmap_grad.addColor(
Color( 0, 0, 255 ) );
89 cmap_grad.addColor(
Color( 0, 255, 0 ) );
90 cmap_grad.addColor(
Color( 255, 0, 0 ) );
95 <<
SetMode( p1.className(),
"Paving" );
111 VertexEmbedder embedder;
112 Distance distance(2.0);
113 DistanceToPoint distanceToPoint = std::bind(distance, embedder(c1), std::placeholders::_1);
115 VertexFunctor vfunctor( embedder, distanceToPoint );
116 Visitor visitor( obj, vfunctor, c1 );
118 while( ! visitor.finished() )
120 Scalar v = visitor.current().second;
121 image.setValue( visitor.current().first, v );
125 string specificStyle = p1.className() +
"/Paving";
128 it != shape_set.end();
135 else if(
image(*it) > 0 )
138 cmap_grad(
image(*it) ) ) );
146 trace.
info() <<
"- Output file testDistancePropagation.eps" << std::endl;
147 board.
saveEPS(
"testDistancePropagation.eps");
152 VisitorRange range(
new Visitor( obj, vfunctor, c1 ) );
155 unsigned int nbok = 0;
156 unsigned int nbperfect = 0;
157 for ( VisitorRange::NodeConstIterator it = range.beginNode(), itEnd = range.endNode();
160 Scalar next_d = (*it).second;
161 ++nb; nbok += (next_d >= d-0.75 ) ? 1 : 0;
162 nbperfect += (next_d >= d ) ? 1 : 0;
166 <<
") number of vertices in approximate Euclidean distance ordering."<< std::endl;
167 trace.
info() <<
"(" << nbperfect <<
"/" << nb
168 <<
") number of vertices in perfect Euclidean distance ordering."<< std::endl;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: This class is useful to perform a breadth-first exploration of a graph given a starting point or...
Structure representing an RGB triple with alpha component.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: This class is useful to perform an exploration of a graph given a starting point or set (called ...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: Transforms a graph visitor into a single pass input range.
std::string className() const
Aim: implements association bewteen points lying in a digital domain and values.
Aim: implements l_p metrics.
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Component Coordinate
Type for Point elements.
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
void beginBlock(const std::string &keyword="")
Aim: Define a new Functor from the composition of two other functors.
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
MyDigitalSurface::ConstIterator ConstIterator
BreadthFirstVisitor< MyDigitalSurface > Visitor
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Aim: A trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Aim: Define utilities to convert a digital set into an image.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Aim: Defines the concept of a visitor onto a graph, that is an object that traverses vertices of the ...
Aim: Represents the concept of local graph: each vertex has neighboring vertices, but we do not neces...
HyperRectDomain< Space > Domain
References DGtal::GradientColorMap< PValue, PDefaultPreset, PDefaultFirstColor, PDefaultLastColor >::addColor(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::current(), domain, DGtal::Trace::endBlock(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::finished(), image(), DGtal::Trace::info(), LibBoard::Board::saveEPS(), and DGtal::trace.
Referenced by main().