18 #include "DGtal/helpers/StdDefs.h"
19 #include "DGtal/io/readers/VolReader.h"
20 #include "DGtal/io/DrawWithDisplay3DModifier.h"
21 #include "DGtal/io/viewers/Viewer3D.h"
22 #include "DGtal/io/Color.h"
23 #include "DGtal/io/colormaps/HueShadeColorMap.h"
24 #include "DGtal/images/ImageSelector.h"
25 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
26 #include "DGtal/shapes/implicit/ImplicitBall.h"
27 #include "DGtal/shapes/GaussDigitizer.h"
28 #include "DGtal/shapes/Shapes.h"
29 #include "DGtal/topology/DigitalSurface.h"
30 #include "DGtal/topology/ExplicitDigitalSurface.h"
31 #include "DGtal/topology/helpers/FrontierPredicate.h"
32 #include "DGtal/topology/helpers/BoundaryPredicate.h"
38 using namespace DGtal;
43 int main(
int argc,
char** argv )
52 EuclideanShape ball1( c1, radius1 );
55 shape1.
init( RealPoint( -10.0, -10.0, -10.0 ),
56 RealPoint( 10.0, 10.0, 10.0 ), 1.0 );
59 EuclideanShape ball2( c2, radius2 );
62 shape2.
init( RealPoint( -10.0, -10.0, -10.0 ),
63 RealPoint( 10.0, 10.0, 10.0 ), 1.0 );
65 Image image( domain );
66 std::cerr << std::endl;
71 label += shape2( *it ) ? 2 : 0;
72 image.setValue( *it, label );
73 std::cerr << (int) image( *it );
75 std::cerr << std::endl;
79 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
84 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
93 MySurfelAdjacency surfAdj(
true );
101 SCell vox1 = K.sSpel( c1 + Point( radius1, 0, 0 ), K.POS );
102 SCell bel10 = K.sIncident( vox1, 0,
true );
103 FSurfelPredicate surfPredicate10( K, image, 1, 0 );
104 Frontier frontier10 =
105 new FrontierContainer( K, surfPredicate10, surfAdj, bel10 );
107 SCell vox2 = K.sSpel( c2 - Point( radius2, 0, 0 ), K.POS );
108 SCell bel20 = K.sIncident( vox2, 0,
false );
109 FSurfelPredicate surfPredicate20( K, image, 2, 0 );
110 Frontier frontier20 =
111 new FrontierContainer( K, surfPredicate20, surfAdj, bel20 );
113 SCell vox3 = K.sSpel( c1 - Point( radius1, 0, 0 ), K.POS );
114 SCell bel32 = K.sIncident( vox3, 0,
false );
115 BSurfelPredicate surfPredicate3( K, image, 3 );
117 new BoundaryContainer( K, surfPredicate3, surfAdj, bel32 );
123 QApplication application(argc,argv);
130 unsigned int nbSurfels10 = 0;
132 for ( Frontier::ConstIterator
133 it = frontier10.begin(), it_end = frontier10.end();
134 it != it_end; ++it, ++nbSurfels10 )
137 unsigned int nbSurfels20 = 0;
139 for ( Frontier::ConstIterator
140 it = frontier20.begin(), it_end = frontier20.end();
141 it != it_end; ++it, ++nbSurfels20 )
144 unsigned int nbSurfels3 = 0;
146 for ( Boundary::ConstIterator
147 it = boundary3.begin(), it_end = boundary3.end();
148 it != it_end; ++it, ++nbSurfels3 )
150 trace.
info() <<
"nbSurfels10 = " << nbSurfels10
151 <<
", nbSurfels20 = " << nbSurfels20
152 <<
", nbSurfels3 = " << nbSurfels3 << std::endl;
153 viewer << Viewer3D<>::updateDisplay;
155 return application.exec();
void beginBlock(const std::string &keyword="")
Aim: The predicate on surfels that represents the frontier between two regions in an image...
const ConstIterator & begin() const
Aim: implements association bewteen points lying in a digital domain and values.
const ConstIterator & end() const
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
KhalimskySpaceND< 2, Integer > KSpace
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: The predicate on surfels that represents the frontier between a region and its complementary in ...
void attach(const EuclideanShape &shape)
std::string className() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD...
const Point & upperBound() const
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint8_t uint8_t
unsigned 8-bit integer.
Structure representing an RGB triple with alpha component.
Space::RealPoint RealPoint
const Point & lowerBound() const
Modifier class in a Display3D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithDisplay3D.