A simple example illustrating the extraction of 3d connected set of KhalimskyCell. This program outputs these images:
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/Color.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/io/Color.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/topology/helpers/Surfaces.h"
using namespace Z3i;
int main(
int argc,
char** argv )
{
unsigned int nbSeeds = 35;
vector<Point> vCenters;
vector<uint> vRad;
for(unsigned int i=0;i<nbSeeds; i++){
vCenters.push_back(
Point(rand()%p2[0], rand()%p2[1],
rand()%p2[2]));
vRad.push_back(rand()%7);
}
for ( Domain::ConstIterator it =
domain.begin(); it !=
domain.end(); ++it ){
for(unsigned int i=0;i<nbSeeds; i++){
if ( (*it - vCenters.at(i) ).norm1() <= vRad.at(i) &&
domain.isInside(*it) &&
diamond_set.insertNew( *it );
break;
}
}
}
vector<vector<SCell> > vectConnectedSCell;
QApplication application(argc,argv);
for(unsigned int i=0; i< vectConnectedSCell.size();i++){
for(unsigned int j=0; j< vectConnectedSCell.at(i).size();j++){
viewer << vectConnectedSCell.at(i).at(j);
}
}
viewer << diamond_set;
viewer << Viewer3D<>::updateDisplay;
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: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
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.
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet