56#include "DGtal/base/Common.h"
57#include "DGtal/io/readers/VolReader.h"
58#include "DGtal/helpers/StdDefs.h"
59#include "DGtal/topology/helpers/Surfaces.h"
60#include "DGtal/topology/DigitalSurface.h"
61#include "DGtal/topology/SetOfSurfels.h"
62#include "DGtal/images/ImageSelector.h"
63#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
75void usage(
int,
char** argv )
77 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT> <int=0|ext=1>" << std::endl;
78 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;
79 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
80 std::cerr <<
"\t - 0: interior adjacency, 1: exterior adjacency." << std::endl;
83int main(
int argc,
char** argv )
90 std::string inputFilename = argv[ 1 ];
91 unsigned int minThreshold = atoi( argv[ 2 ] );
92 unsigned int maxThreshold = atoi( argv[ 3 ] );
93 bool intAdjacency = atoi( argv[ 4 ] ) == 0;
101 minThreshold, maxThreshold);
108 bool space_ok =
K.
init( image.domain().lowerBound(),
109 image.domain().upperBound(),
true );
112 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
119 MySurfelAdjacency surfAdj( intAdjacency );
128 MySetOfSurfels theSetOfSurfels(
K, surfAdj );
131 image.
domain().lowerBound(),
132 image.domain().upperBound() );
134 trace.
info() <<
"Digital surface has " << digSurf.
size() <<
" surfels."
141 ofstream out(
"marching-cube.off" );
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
const Domain & domain() const
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
void exportSurfaceAs3DOFF(std::ostream &out) const
Aim: implements association bewteen points lying in a digital domain and values.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
MyDigitalSurface::SurfelSet SurfelSet
DGtal is the top-level namespace which contains all DGtal functions and types.
ImageContainerBySTLVector< Domain, Value > Type
Aim: Define utilities to convert a digital set into an image.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())