#include <iostream>
#include <fstream>
#include <algorithm>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/writers/VolWriter.h"
#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
#include "DGtal/shapes/implicit/ImplicitBall.h"
#include "DGtal/base/BasicFunctors.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include <boost/algorithm/minmax_element.hpp>
int main(
int argc,
char ** argv)
{
trace.
info() << image << std::endl;
QApplication application(argc,argv);
for(Image::Domain::ConstIterator it = image.domain().begin(),
itend = image.domain().end(); it != itend; ++it)
if (image(*it) != 0)
viewer << *it;
viewer << DGtal::Viewer3D<>::updateDisplay;
trace.
info() <<
"viewer launched..."<<std::endl;
bool res = application.exec();
Predicate binaryshape(image, 0);
DT distancemap(image.domain(), binaryshape, l2);
QApplication application2(argc,argv);
DT::Value maxDT = (*boost::first_max_element(distancemap.constRange().begin(),
distancemap.constRange().end()));
trace.
info() <<
"we display the dt map"<<std::endl;
int cpt=0;
for(DT::Domain::ConstIterator it = distancemap.domain().begin(),
itend = distancemap.domain().end(); it != itend;
++it)
if (distancemap(*it) > 0)
{
DT::Value val= distancemap( *it );
cpt++;
}
trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
viewer2 << DGtal::Viewer3D<>::updateDisplay;
trace.
info() <<
"viewer2 launched..."<<std::endl;
res = res && application2.exec();
Image imageGranulo ( image.domain() );
for(Image::Range::Iterator it = imageGranulo.
range().begin(), itend= imageGranulo.
range().end();
it != itend; ++it)
*it = 0;
trace.
info() <<
"Computing the granulometry"<<std::endl;
cpt=0;
for(Image::Domain::ConstIterator it = imageGranulo.
domain().begin(),
itend = imageGranulo.
domain().end(); it != itend; ++it)
{
if (distancemap(*it) > 0)
{
unsigned int radius = (unsigned int)distancemap(*it);
itball != itendball; itball++)
if (imageGranulo.
domain().isInside(*itball) &&
( ball(*itball) > 0) &&
(imageGranulo(*itball) < radius))
cpt++;
}
}
trace.
info() <<
"Granulometry ok nbBalls="<<cpt<< std::endl;
trace.
info() <<
"Save OK"<< std::endl;
QApplication application3(argc,argv);
Image::Value maxG = (*boost::first_max_element(imageGranulo.
constRange().begin(),
cpt=0;
for(Image::Domain::ConstIterator it = imageGranulo.
domain().begin(),
itend = imageGranulo.
domain().end(); it != itend;
++it)
if (imageGranulo(*it) > 0)
{
Image::Value val= imageGranulo( *it );
cpt++;
}
trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
viewer3 << DGtal::Viewer3D<>::updateDisplay;
trace.
info() <<
"viewer3 launched..."<<std::endl;
return res && application3.exec();
}
Structure representing an RGB triple with alpha component.
static const Color Yellow
Aim: implements separable l_p metrics with exact predicates.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const
const Domain & domain() const
ConstRange constRange() const
void setValue(const Point &aPoint, const Value &aValue)
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
RealPoint getUpperBound() const
RealPoint getLowerBound() const
Aim: Implements basic operations that will be used in Point and Vector classes.
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Define a simple Foreground predicate thresholding image values given a single thresold....
DGtal is the top-level namespace which contains all DGtal functions and types.
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
Aim: implements methods to read a "Vol" file format.
Aim: Export a 3D Image using the Vol formats.
Functor that rounds down.
ImageContainerBySTLVector< Domain, Value > Image