44#include "DGtal/base/Common.h"
46#include "DGtal/helpers/StdDefs.h"
47#include "DGtal/topology/KhalimskySpaceND.h"
48#include "DGtal/topology/SurfelAdjacency.h"
49#include "DGtal/topology/DigitalSurface.h"
50#include "DGtal/topology/SetOfSurfels.h"
51#include "DGtal/topology/DigitalSurface2DSlice.h"
52#include "DGtal/topology/helpers/Surfaces.h"
54#include "DGtal/io/readers/VolReader.h"
55#include "DGtal/io/viewers/PolyscopeViewer.h"
56#include "DGtal/images/ImageSelector.h"
57#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
58#include "DGtal/io/Color.h"
59#include "DGtal/io/colormaps/GradientColorMap.h"
61#include "ConfigExamples.h"
74 std::string inputFilename = examplesPath +
"samples/Al.100.vol";
84 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
90 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
98 MySurfelAdjacency surfAdj(
true );
107 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
113 trace.
info() <<
"Digital surface has " << digSurf.
size() <<
" surfels."
124 MyTracker* tracker1 = digSurf.
container().newTracker( surf );
125 MyTracker* tracker2 = digSurf.
container().newTracker( surf );
128 My2DSlice slice1( tracker1, *(ks.
sDirs( surf )) );
131 My2DSlice slice2( tracker2, *++(ks.
sDirs( surf )) );
137 ASSERT( slice1.start() == slice1.begin() );
138 ASSERT( slice1.cstart() == slice1.c() );
139 ASSERT( *slice1.begin() == surf );
140 ASSERT( *slice1.c() == surf );
141 ASSERT( *slice1.start() == surf );
142 ASSERT( *slice1.cstart() == surf );
143 ASSERT( *slice1.rcstart() == surf );
144 ASSERT( slice1.rcstart() == slice1.rc() );
145 ASSERT( *slice1.rc() == surf );
146 ASSERT( *(slice1.c()+1) == *(slice1.begin()+1) );
147 ASSERT( *(slice1.rc()+1) == *(slice1.rbegin()) );
153 it_end = theSetOfSurfels.end(); it != it_end; ++it )
166 for ( My2DSlice::ConstIterator it = slice1.begin(),
167 it_end = slice1.end(); it != it_end; ++it )
169 Color col= cmap_grad(d);
181 for ( My2DSlice::ConstIterator it = slice2.begin(),
182 it_end = slice2.end(); it != it_end; ++it )
184 Color col= cmap_grad2(d);
Structure representing an RGB triple with alpha component.
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
void blue(const unsigned char aBlueValue)
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
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
void drawColor(const DGtal::Color &color)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
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).
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
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.
ImageContainerBySTLVector< Domain, Value > Type
Aim: Define utilities to convert a digital set into an image.
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())