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/images/ImageSelector.h"
26 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
27 #include "DGtal/shapes/Shapes.h"
28 #include "DGtal/helpers/StdDefs.h"
29 #include "DGtal/topology/helpers/Surfaces.h"
35 using namespace DGtal;
40 void usage(
int ,
char** argv )
42 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT>" << std::endl;
43 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
44 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
47 int main(
int argc,
char** argv )
54 std::string inputFilename = argv[ 1 ];
55 unsigned int minThreshold = atoi( argv[ 2 ] );
56 unsigned int maxThreshold = atoi( argv[ 3 ] );
65 minThreshold, maxThreshold);
71 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
73 bool space_ok = ks.
init( image.domain().lowerBound(),
74 image.domain().upperBound(), true );
77 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
85 MySurfelAdjacency surfAdj(
true );
89 trace.
beginBlock(
"Extracting boundary by tracking from an initial bel." );
94 set3dPredicate, bel );
100 QApplication application(argc,argv);
104 unsigned long nbSurfels = 0;
105 for ( KSpace::SCellSet::const_iterator it = boundary.begin(),
106 it_end = boundary.end(); it != it_end; ++it, ++nbSurfels )
108 viewer << Viewer3D::updateDisplay;
109 trace.
info() <<
"nb surfels = " << nbSurfels << std::endl;
111 return application.exec();