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;
95 trace.beginBlock(
"Reading vol file into an image." );
97 std::string inputFilename = examplesPath +
"samples/cat10.vol";
101 trace.info() << set3d.
size() <<
" voxels." << std::endl;
105 trace.beginBlock(
"Construct the Khalimsky space from the image domain." );
111 MySurfelAdjacency surfAdj(
true );
113 trace.beginBlock(
"Extracting boundary by scanning the space. " );
118 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
121 image.domain().lowerBound(),
122 image.domain().upperBound() );
124 trace.info() << digSurf.
size() <<
" surfels." << std::endl;
128 trace.beginBlock(
"Extracting slice and constructing a grid curve. " );
138 My2DSlice slice( tracker, *(ks.
sDirs( surf )) );
150 trace.beginBlock(
"Display all with Viewer." );
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;
84int main(
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
DigitalSurfaceTracker * newTracker(const Surfel &s) 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
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.
std::set< SCell > SurfelSet
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.
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...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
MyDigitalSurface::SurfelSet SurfelSet
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
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
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())