18 #include <QImageReader>
20 #include "DGtal/io/readers/VolReader.h"
21 #include "DGtal/io/DrawWithDisplay3DModifier.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/Shapes.h"
27 #include "DGtal/helpers/StdDefs.h"
28 #include "DGtal/topology/DigitalSurface.h"
29 #include "DGtal/topology/LightImplicitDigitalSurface.h"
30 #include "DGtal/io/viewers/Viewer3D.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 ] );
66 minThreshold, maxThreshold);
72 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
74 bool space_ok = ks.init( image.domain().lowerBound(),
75 image.domain().upperBound(), true );
78 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
86 MySurfelAdjacency surfAdj(
true );
95 MyDigitalSurfaceContainer* ptrSurfContainer =
96 new MyDigitalSurfaceContainer( ks, set3d, surfAdj, bel );
97 MyDigitalSurface digSurf( ptrSurfContainer );
102 trace.
beginBlock(
"Extracting boundary by tracking from an initial bel." );
104 typedef MyBreadthFirstVisitor::Node MyNode;
105 typedef MyBreadthFirstVisitor::Size MySize;
106 MyBreadthFirstVisitor visitor( digSurf, bel );
107 unsigned long nbSurfels = 0;
109 while ( ! visitor.finished() )
111 node = visitor.current();
115 MySize maxDist = node.second;
121 QApplication application(argc,argv);
125 MyBreadthFirstVisitor visitor2( digSurf, bel );
127 << ks.unsigns( bel );
129 while ( ! visitor2.finished() )
131 node = visitor2.current();
132 Color c = hueShade( node.second );
134 << ks.unsigns( node.first );
137 viewer << Viewer3D<>::updateDisplay;
138 trace.
info() <<
"nb surfels = " << nbSurfels << std::endl;
140 return application.exec();
void beginBlock(const std::string &keyword="")
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: implements association bewteen points lying in a digital domain and values.
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
KhalimskySpaceND< 2, Integer > KSpace
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Aim: implements methods to read a "Vol" file format.
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Define utilities to convert a digital set into an image.
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.
const Domain & domain() const