33 #include "DGtal/base/Common.h"
34 #include "DGtal/io/readers/VolReader.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/topology/helpers/Surfaces.h"
37 #include "DGtal/topology/DigitalSurface.h"
38 #include "DGtal/topology/SetOfSurfels.h"
39 #include "DGtal/images/ImageSelector.h"
40 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
46 using namespace DGtal;
52 void usage(
int,
char** argv )
54 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT> <int=0|ext=1>" << std::endl;
55 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol> as an OFF geomview surface file. It is a kind of marching-cube surface, defined by duality with respect to the digital surface." << std::endl;
56 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
57 std::cerr <<
"\t - 0: interior adjacency, 1: exterior adjacency." << std::endl;
60 int main(
int argc,
char** argv )
67 std::string inputFilename = argv[ 1 ];
68 unsigned int minThreshold = atoi( argv[ 2 ] );
69 unsigned int maxThreshold = atoi( argv[ 3 ] );
70 bool intAdjacency = atoi( argv[ 4 ] ) == 0;
78 minThreshold, maxThreshold);
85 bool space_ok = K.init( image.domain().lowerBound(),
86 image.domain().upperBound(), true );
89 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
96 MySurfelAdjacency surfAdj( intAdjacency );
101 typedef KSpace::SurfelSet SurfelSet;
105 MySetOfSurfels theSetOfSurfels( K, surfAdj );
108 image.domain().lowerBound(),
109 image.domain().upperBound() );
110 MyDigitalSurface digSurf( theSetOfSurfels );
111 trace.
info() <<
"Digital surface has " << digSurf.size() <<
" surfels."
118 ofstream out(
"marching-cube.off" );
120 digSurf.exportSurfaceAs3DOFF( out );
void beginBlock(const std::string &keyword="")
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Aim: implements association bewteen points lying in a digital domain and values.
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: 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: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels...
const Domain & domain() const