18 #include <QImageReader>
19 #include <QtGui/qapplication.h>
20 #include "DGtal/kernel/sets/SetPredicate.h"
21 #include "DGtal/io/readers/VolReader.h"
22 #include "DGtal/io/viewers/Viewer3D.h"
23 #include "DGtal/io/DrawWithDisplay3DModifier.h"
24 #include "DGtal/io/Color.h"
25 #include "DGtal/io/colormaps/HueShadeColorMap.h"
26 #include "DGtal/images/ImageSelector.h"
27 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
28 #include "DGtal/shapes/Shapes.h"
29 #include "DGtal/helpers/StdDefs.h"
30 #include "DGtal/topology/DigitalSurface.h"
31 #include "DGtal/topology/LightImplicitDigitalSurface.h"
37 using namespace DGtal;
42 void usage(
int,
char** argv )
44 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT>" << std::endl;
45 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
46 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
49 int main(
int argc,
char** argv )
56 std::string inputFilename = argv[ 1 ];
57 unsigned int minThreshold = atoi( argv[ 2 ] );
58 unsigned int maxThreshold = atoi( argv[ 3 ] );
67 minThreshold, maxThreshold);
73 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
75 bool space_ok = ks.
init( image.domain().lowerBound(),
76 image.domain().upperBound(), true );
79 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
87 MySurfelAdjacency surfAdj(
true );
96 MyDigitalSurfaceContainer* ptrSurfContainer =
97 new MyDigitalSurfaceContainer( ks, set3dPredicate, surfAdj, bel );
98 MyDigitalSurface digSurf( ptrSurfContainer );
103 trace.
beginBlock(
"Extracting boundary by tracking from an initial bel." );
105 typedef MyBreadthFirstVisitor::Node MyNode;
106 typedef MyBreadthFirstVisitor::Size MySize;
107 MyBreadthFirstVisitor visitor( digSurf, bel );
108 unsigned long nbSurfels = 0;
110 while ( ! visitor.finished() )
112 node = visitor.current();
116 MySize maxDist = node.second;
122 QApplication application(argc,argv);
126 MyBreadthFirstVisitor visitor2( digSurf, bel );
130 while ( ! visitor2.finished() )
132 node = visitor2.current();
133 Color c = hueShade( node.second );
138 viewer << Viewer3D::updateDisplay;
139 trace.
info() <<
"nb surfels = " << nbSurfels << std::endl;
141 return application.exec();