55#include "DGtal/base/Common.h"
57#include "DGtal/helpers/StdDefs.h"
58#include "DGtal/topology/KhalimskySpaceND.h"
59#include "DGtal/topology/SurfelAdjacency.h"
60#include "DGtal/topology/DigitalSurface.h"
61#include "DGtal/topology/SetOfSurfels.h"
62#include "DGtal/topology/DigitalSurface2DSlice.h"
63#include "DGtal/topology/helpers/Surfaces.h"
65#include "DGtal/io/viewers/Viewer3D.h"
66#include "DGtal/io/readers/VolReader.h"
67#include "DGtal/io/DrawWithDisplay3DModifier.h"
68#include "DGtal/images/ImageSelector.h"
69#include "DGtal/images/ImageHelper.h"
70#include "DGtal/kernel/sets/DigitalSetInserter.h"
71#include "DGtal/io/Color.h"
73#include "DGtal/geometry/curves/GridCurve.h"
75#include "ConfigExamples.h"
85int main(
int argc,
char** argv )
87 trace.
info() <<
"exampleGridCurve3d-2: the type of data to be displayed "
88 <<
"may be given as argument as follows: "
89 << argv[0] <<
" inner" << endl;
90 trace.
info() <<
"Available types are: gridcurve (default), inner, outer, incident" << endl;
92 string type = (argc > 1) ?
string(argv[1]) :
"gridcurve";
93 trace.
info() <<
"Chosen type: " << type << endl;
98 std::string inputFilename = examplesPath +
"samples/cat10.vol";
106 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
112 MySurfelAdjacency surfAdj(
true );
119 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
122 image.
domain().lowerBound(),
123 image.domain().upperBound() );
129 trace.
beginBlock(
"Extracting slice and constructing a grid curve. " );
135 MyTracker* tracker = digSurf.
container().newTracker( surf );
139 My2DSlice slice( tracker, *(ks.
sDirs( surf )) );
151 QApplication application(argc,argv);
158 it_end = theSetOfSurfels.end(); it != it_end; ++it )
163 viewer << Viewer3D<Space, KSpace>::shiftSurfelVisu;
167 if (type ==
"gridcurve")
171 else if (type ==
"inner")
175 else if (type ==
"outer")
179 else if (type ==
"incident")
185 trace.
info() <<
"Display type not known." << std::endl;
188 viewer << Viewer3D<Space, KSpace>::updateDisplay;
191 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...
const Domain & domain() const
Aim: this output iterator class is designed to allow algorithms to insert points in the digital set....
Aim: Represents a 2-dimensional slice in a DigitalSurface. In a sense, it is a 4-connected contour,...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
const DigitalSurfaceContainer & container() const
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
DigitalSurfaceContainer::DigitalSurfaceTracker DigitalSurfaceTracker
ConstIterator begin() const
virtual void setFillColor(DGtal::Color aColor)
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
IncidentPointsRange getIncidentPointsRange() const
OuterPointsRange getOuterPointsRange() const
InnerPointsRange getInnerPointsRange() const
bool initFromSCellsRange(const TIterator &itb, const TIterator &ite)
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).
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
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="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
MyDigitalSurface::SurfelSet SurfelSet
DGtal is the top-level namespace which contains all DGtal functions and types.
void setFromImage(const I &aImg, const O &ito, const typename I::Value &aThreshold=0)
ImageContainerBySTLVector< Domain, Value > Type
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())