17 #include <QtGui/qapplication.h>
18 #include "DGtal/helpers/StdDefs.h"
19 #include "DGtal/kernel/sets/SetPredicate.h"
20 #include "DGtal/io/readers/VolReader.h"
21 #include "DGtal/io/viewers/Viewer3D.h"
22 #include "DGtal/io/DrawWithDisplay3DModifier.h"
23 #include "DGtal/io/Color.h"
24 #include "DGtal/io/colormaps/HueShadeColorMap.h"
25 #include "DGtal/images/ImageSelector.h"
26 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
27 #include "DGtal/shapes/implicit/ImplicitBall.h"
28 #include "DGtal/shapes/GaussDigitizer.h"
29 #include "DGtal/shapes/Shapes.h"
30 #include "DGtal/topology/DigitalSurface.h"
31 #include "DGtal/topology/ExplicitDigitalSurface.h"
32 #include "DGtal/topology/helpers/FrontierPredicate.h"
33 #include "DGtal/topology/helpers/BoundaryPredicate.h"
39 using namespace DGtal;
44 int main(
int argc,
char** argv )
53 EuclideanShape ball1( c1, radius1 );
56 shape1.
init( RealPoint( -10.0, -10.0, -10.0 ),
57 RealPoint( 10.0, 10.0, 10.0 ), 1.0 );
60 EuclideanShape ball2( c2, radius2 );
63 shape2.
init( RealPoint( -10.0, -10.0, -10.0 ),
64 RealPoint( 10.0, 10.0, 10.0 ), 1.0 );
66 Image image( domain );
67 std::cerr << std::endl;
72 label += shape2( *it ) ? 2 : 0;
73 image.setValue( *it, label );
74 std::cerr << (int) image( *it );
76 std::cerr << std::endl;
80 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
85 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
94 MySurfelAdjacency surfAdj(
true );
104 FSurfelPredicate surfPredicate10( K, image, 1, 0 );
105 Frontier frontier10 =
106 new FrontierContainer( K, surfPredicate10, surfAdj, bel10 );
110 FSurfelPredicate surfPredicate20( K, image, 2, 0 );
111 Frontier frontier20 =
112 new FrontierContainer( K, surfPredicate20, surfAdj, bel20 );
116 BSurfelPredicate surfPredicate3( K, image, 3 );
118 new BoundaryContainer( K, surfPredicate3, surfAdj, bel32 );
124 QApplication application(argc,argv);
131 unsigned int nbSurfels10 = 0;
133 for ( Frontier::ConstIterator
134 it = frontier10.begin(), it_end = frontier10.end();
135 it != it_end; ++it, ++nbSurfels10 )
138 unsigned int nbSurfels20 = 0;
140 for ( Frontier::ConstIterator
141 it = frontier20.begin(), it_end = frontier20.end();
142 it != it_end; ++it, ++nbSurfels20 )
145 unsigned int nbSurfels3 = 0;
147 for ( Boundary::ConstIterator
148 it = boundary3.begin(), it_end = boundary3.end();
149 it != it_end; ++it, ++nbSurfels3 )
151 trace.
info() <<
"nbSurfels10 = " << nbSurfels10
152 <<
", nbSurfels20 = " << nbSurfels20
153 <<
", nbSurfels3 = " << nbSurfels3 << std::endl;
154 viewer << Viewer3D::updateDisplay;
156 return application.exec();