36 #include "DGtal/base/Common.h" 37 #include "DGtal/kernel/CanonicEmbedder.h" 38 #include "DGtal/io/readers/VolReader.h" 39 #include "DGtal/images/ImageSelector.h" 40 #include "DGtal/images/imagesSetsUtils/SetFromImage.h" 41 #include "DGtal/images/ImageLinearCellEmbedder.h" 42 #include "DGtal/shapes/Shapes.h" 43 #include "DGtal/helpers/StdDefs.h" 44 #include "DGtal/topology/helpers/Surfaces.h" 45 #include "DGtal/topology/DigitalSurface.h" 46 #include "DGtal/topology/SetOfSurfels.h" 52 using namespace DGtal;
59 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT> <Adj>" << std::endl;
60 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
61 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
62 std::cerr <<
"\t - 0: interior adjacency, 1: exterior adjacency." << std::endl;
66 int main(
int argc,
char** argv )
73 std::string inputFilename = argv[ 1 ];
74 unsigned int minThreshold = atoi( argv[ 2 ] );
75 unsigned int maxThreshold = atoi( argv[ 3 ] );
76 bool intAdjacency = atoi( argv[ 4 ] ) == 0;
82 DigitalSet set3d (image.domain());
84 minThreshold, maxThreshold);
90 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
92 bool space_ok = ks.
init( image.domain().lowerBound(),
93 image.domain().upperBound(), true );
96 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
104 MySurfelAdjacency surfAdj( intAdjacency );
112 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
116 image.domain().upperBound() );
118 trace.
info() <<
"Digital surface has " << digSurf.size() <<
" surfels." 128 CellEmbedder cellEmbedder;
129 MyEmbedder trivialEmbedder;
132 cellEmbedder.
init( ks, image, trivialEmbedder,
133 ( (
double) minThreshold ) + 0.5 );
134 ofstream out(
"marching-cube.off" );
136 digSurf.exportEmbeddedSurfaceAs3DOFF( out, cellEmbedder );
void beginBlock(const std::string &keyword="")
MyDigitalSurface::SurfelSet SurfelSet
int main(int argc, char **argv)
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).
void usage(int, char **argv)
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: implements methods to read a "Vol" file format.
const Point & lowerBound() const
Return the lower bound for digital points in this space.
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 trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn.
ImageContainerBySTLVector< Domain, Value > Image
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
void init(ConstAlias< KSpace > K, ConstAlias< Image > f, ConstAlias< Embedder > e, double iso_value)
Aim: a cellular embedder for images. (default constructible, copy constructible, assignable)....
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface