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/PolyscopeViewer.h"
66#include "DGtal/io/readers/VolReader.h"
67#include "DGtal/images/ImageSelector.h"
68#include "DGtal/images/ImageHelper.h"
69#include "DGtal/kernel/sets/DigitalSetInserter.h"
70#include "DGtal/io/Color.h"
72#include "DGtal/geometry/curves/GridCurve.h"
74#include "ConfigExamples.h"
84int main(
int argc,
char** argv )
86 trace.
info() <<
"exampleGridCurve3d-2: the type of data to be displayed "
87 <<
"may be given as argument as follows: "
88 << argv[0] <<
" inner" << endl;
89 trace.
info() <<
"Available types are: gridcurve (default), inner, outer, incident" << endl;
91 string type = (argc > 1) ?
string(argv[1]) :
"gridcurve";
92 trace.
info() <<
"Chosen type: " << type << endl;
97 std::string inputFilename = examplesPath +
"samples/cat10.vol";
105 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
111 MySurfelAdjacency surfAdj(
true );
118 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
128 trace.
beginBlock(
"Extracting slice and constructing a grid curve. " );
134 MyTracker* tracker = digSurf.
container().newTracker( surf );
138 My2DSlice slice( tracker, *(ks.
sDirs( surf )) );
155 it_end = theSetOfSurfels.end(); it != it_end; ++it )
159 viewer <<
Color( 50, 50, 255 );
161 if (type ==
"gridcurve")
165 else if (type ==
"inner")
169 else if (type ==
"outer")
173 else if (type ==
"incident")
179 trace.
info() <<
"Display type not known." << std::endl;
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: 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
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.
const Domain & domain() const
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.
void show() override
Starts the event loop and display of elements.
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.
void setFromImage(const I &aImg, const O &ito, const typename I::Value &aThreshold=0)
ImageContainerBySTLVector< Domain, Value > Type
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())