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/DrawWithDisplay3DModifier.h"
56 #include "DGtal/io/viewers/Viewer3D.h"
57 #include "DGtal/images/ImageSelector.h"
58 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
59 #include "DGtal/io/Color.h"
60 #include "DGtal/io/colormaps/GradientColorMap.h"
62 #include "ConfigExamples.h"
66 using namespace DGtal;
70 int main(
int argc,
char** argv )
73 QApplication application(argc,argv);
78 std::string inputFilename = examplesPath +
"samples/Al.100.vol";
89 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
91 bool space_ok = ks.
init( image.domain().lowerBound(),
92 image.domain().upperBound(),
true );
95 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
103 MySurfelAdjacency surfAdj(
true );
112 MySetOfSurfels theSetOfSurfels( ks, surfAdj );
115 image.
domain().lowerBound(),
116 image.domain().upperBound() );
118 trace.
info() <<
"Digital surface has " << digSurf.
size() <<
" surfels."
129 MyTracker* tracker1 = digSurf.
container().newTracker( surf );
130 MyTracker* tracker2 = digSurf.
container().newTracker( surf );
133 My2DSlice slice1( tracker1, *(ks.
sDirs( surf )) );
136 My2DSlice slice2( tracker2, *++(ks.
sDirs( surf )) );
142 ASSERT( slice1.start() == slice1.begin() );
143 ASSERT( slice1.cstart() == slice1.c() );
144 ASSERT( *slice1.begin() == surf );
145 ASSERT( *slice1.c() == surf );
146 ASSERT( *slice1.start() == surf );
147 ASSERT( *slice1.cstart() == surf );
148 ASSERT( *slice1.rcstart() == surf );
149 ASSERT( slice1.rcstart() == slice1.rc() );
150 ASSERT( *slice1.rc() == surf );
151 ASSERT( *(slice1.c()+1) == *(slice1.begin()+1) );
152 ASSERT( *(slice1.rc()+1) == *(slice1.rbegin()) );
159 it_end = theSetOfSurfels.end(); it != it_end; ++it )
169 viewer << Viewer3D<>::shiftSurfelVisu;
175 it_end = slice1.end(); it != it_end; ++it )
177 Color col= cmap_grad(d);
190 it_end = slice2.end(); it != it_end; ++it )
192 Color col= cmap_grad2(d);
199 viewer << Viewer3D<>::shiftSurfelVisu;
202 viewer << Viewer3D<>::updateDisplay;
205 return application.exec();
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...
const Domain & domain() const
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...
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
DigitalSurfaceContainer::DigitalSurfaceTracker DigitalSurfaceTracker
ConstIterator begin() const
const DigitalSurfaceContainer & container() const
virtual void setFillColor(DGtal::Color aColor)
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.
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.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
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...
int main(int argc, char **argv)
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
MyDigitalSurface::ConstIterator ConstIterator
MyDigitalSurface::SurfelSet SurfelSet
DGtal is the top-level namespace which contains all DGtal functions and types.
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.
Aim: implements methods to read a "Vol" file format.
ImageContainerBySTLVector< Domain, Value > Image