41#include "DGtal/base/Common.h"
42#include "DGtal/io/viewers/Viewer3D.h"
43#include "DGtal/io/readers/VolReader.h"
44#include "DGtal/io/DrawWithDisplay3DModifier.h"
45#include "DGtal/io/Color.h"
46#include "DGtal/images/ImageSelector.h"
47#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
48#include "DGtal/shapes/Shapes.h"
49#include "DGtal/helpers/StdDefs.h"
50#include "DGtal/topology/helpers/Surfaces.h"
61void usage(
int ,
char** argv )
63 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT>" << std::endl;
64 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
65 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
68int main(
int argc,
char** argv )
75 std::string inputFilename = argv[ 1 ];
76 unsigned int minThreshold = atoi( argv[ 2 ] );
77 unsigned int maxThreshold = atoi( argv[ 3 ] );
85 minThreshold, maxThreshold);
91 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
93 bool space_ok = ks.
init( image.domain().lowerBound(),
94 image.domain().upperBound(),
true );
97 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
105 MySurfelAdjacency surfAdj(
true );
109 trace.
beginBlock(
"Extracting boundary by tracking from an initial bel." );
120 QApplication application(argc,argv);
125 unsigned long nbSurfels = 0;
126 for ( KSpace::SCellSet::const_iterator it = boundary.begin(),
127 it_end = boundary.end(); it != it_end; ++it, ++nbSurfels )
129 viewer << Viewer3D<>::updateDisplay;
130 trace.
info() <<
"nb surfels = " << nbSurfels << std::endl;
132 return application.exec();
Structure representing an RGB triple with alpha component.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
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,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
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.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
std::string className() const
Return the style name used for drawing this object.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())