33 #include <QtGui/qapplication.h>
35 #include "DGtal/base/Common.h"
36 #include "DGtal/kernel/SpaceND.h"
37 #include "DGtal/kernel/domains/HyperRectDomain.h"
38 #include "DGtal/images/ImageSelector.h"
39 #include "DGtal/io/readers/VolReader.h"
40 #include "DGtal/io/viewers/Viewer3D.h"
42 #include "DGtal/io/Color.h"
43 #include "DGtal/io/colormaps/GradientColorMap.h"
44 #include "DGtal/io/DrawWithDisplay3DModifier.h"
46 #include "DGtal/kernel/SpaceND.h"
47 #include "DGtal/kernel/domains/HyperRectDomain.h"
48 #include "DGtal/images/ImageSelector.h"
50 #include "DGtal/geometry/volumes/distance/SeparableMetricHelper.h"
51 #include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
52 #include "DGtal/images/imagesSetsUtils/SimpleThresholdForegroundPredicate.h"
54 #include "ConfigExamples.h"
60 using namespace DGtal;
72 template<
typename Image>
73 void randomSeeds(
Image &image,
const unsigned int nb,
const int value)
81 for (
unsigned int k = 0 ; k < nb; k++)
83 for (
unsigned int dim = 0; dim < Image::dimension; dim++)
84 p[dim] = rand() % (ext[dim]) + low[dim];
90 int main(
int argc,
char** argv )
93 std::string inputFilename = examplesPath +
"samples/Al.100.vol";
100 typedef TDomain::Point
Point;
103 QApplication application(argc,argv);
105 viewer.setWindowTitle(
"simpleViewer");
113 TDomain domain = image.
domain();
116 Image imageSeeds ( domain);
117 for (
Image::Iterator it = imageSeeds.begin(), itend = imageSeeds.end();it != itend; ++it)
121 randomSeeds(imageSeeds, 70, 0);
128 Predicate aPredicate(imageSeeds,0);
134 DTL2 dtL2(domain, aPredicate);
135 DTLInf dtLinf(domain, aPredicate);
136 DTL1 dtL1(domain, aPredicate);
139 DTL1::OutputImage resultL1 = dtL1.compute ( );
141 unsigned int min = 0;
142 unsigned int max = 0;
143 for(DTL1::OutputImage::ConstIterator it = resultL1.begin(), itend=resultL1.end();
155 gradient.addColor(Color::Red);
156 gradient.addColor(Color::Yellow);
157 gradient.addColor(Color::Green);
158 gradient.addColor(Color::Cyan);
159 gradient.addColor(Color::Blue);
160 gradient.addColor(Color::Magenta);
161 gradient.addColor(Color::Red);
164 viewer <<
SetMode3D( (*(domain.begin())).className(),
"Paving" );
166 for(TDomain::ConstIterator it = domain.begin(), itend=domain.end();
170 unsigned int valDist= resultL1( (*it) );
171 Color c= gradient(valDist);
173 if(resultL1(*it)<=30 ){
176 (
float)(c.
blue(),205)),
179 (
float)(c.
blue()),205));
185 viewer<< Viewer3D::updateDisplay;
187 return application.exec();