32#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/topology/KhalimskySpaceND.h"
36#include "DGtal/topology/helpers/Surfaces.h"
38#include "DGtal/io/viewers/Viewer3D.h"
39#include "DGtal/io/readers/VolReader.h"
40#include "DGtal/io/DrawWithDisplay3DModifier.h"
41#include "DGtal/images/ImageSelector.h"
42#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
43#include "DGtal/io/Color.h"
44#include "DGtal/io/colormaps/GradientColorMap.h"
46#include "ConfigExamples.h"
53int main(
int argc,
char** argv )
57 QApplication application(argc,argv);
60 std::string inputFilename = examplesPath +
"samples/cat10.vol";
67 bool space_ok = ks.
init( image.domain().lowerBound(), image.domain().upperBound(),
true );
71 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
75 std::vector<Z3i::SCell> vectBdrySCell;
76 std::vector<Z3i::SCell> vectBdrySCell2;
77 std::set<Z3i::SCell> vectBdrySCellALL;
84 trace.
info() <<
"Tracking Boundary.."<<std::endl;
87 ks,SAdj, set3d, aCell );
91 ks, *(ks.
sDirs( aCell )), SAdj,
96 ks, *(++(ks.
sDirs( aCell ))), SAdj,
101 typedef Viewer3D <Z3i::Space,Z3i::KSpace>
MyViewer;
105 trace.
info() <<
"Displaying the surfels.."<<std::endl;
106 viewer <<
SetMode3D((*(vectBdrySCellALL.begin())).className(),
"Transparent");
107 for( std::set<Z3i::SCell>::iterator it=vectBdrySCellALL.begin();
108 it!= vectBdrySCellALL.end(); it++){
119 viewer << Viewer3D<Z3i::Space,Z3i::KSpace>::shiftSurfelVisu;
120 viewer <<
SetMode3D((*(vectBdrySCell2.begin())).className(),
"");
124 for( std::vector<Z3i::SCell>::iterator it=vectBdrySCell2.begin();
125 it!= vectBdrySCell2.end(); it++){
126 Color col= cmap_grad(d);
136 viewer << Viewer3D<>::shiftSurfelVisu;
139 for( std::vector<Z3i::SCell>::iterator it=vectBdrySCell.begin();
140 it!= vectBdrySCell.end(); it++){
141 Color col= cmap_grad2(d);
153 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...
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,...
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.
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void track2DSliceBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
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...
DGtal is the top-level namespace which contains all DGtal functions and types.
ImageContainerBySTLVector< Domain, Value > Type
static void append(Set &aSet, const ForegroundPredicate &isForeground, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
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.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
ImageContainerBySTLVector< Domain, Value > Image