37#include "DGtal/base/Common.h"
38#include "DGtal/helpers/StdDefs.h"
40#include "DGtal/images/ImageContainerBySTLVector.h"
42#include "DGtal/io/readers/VolReader.h"
43#include "DGtal/io/writers/VolWriter.h"
45#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
46#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
47#include "DGtal/shapes/implicit/ImplicitBall.h"
48#include "DGtal/base/BasicFunctors.h"
50#include "DGtal/io/viewers/PolyscopeViewer.h"
51#include "DGtal/io/colormaps/GradientColorMap.h"
53#include <boost/algorithm/minmax_element.hpp>
57int main(
int argc,
char ** argv)
73 trace.
info() <<
"viewer launched..."<<std::endl;
80 Predicate binaryshape(
image, 0);
88 DT::Value maxDT = (*boost::first_max_element(distancemap.constRange().begin(),
89 distancemap.constRange().end()));
90 trace.
info() <<
"we display the dt map"<<std::endl;
94 for(DT::Domain::ConstIterator it = distancemap.domain().begin(),
95 itend = distancemap.domain().end(); it != itend;
97 if (distancemap(*it) > 0)
102 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
103 trace.
info() <<
"viewer2 launched..."<<std::endl;
113 trace.
info() <<
"Computing the granulometry"<<std::endl;
116 itend = imageGranulo.
domain().end(); it != itend; ++it)
118 if (distancemap(*it) > 0)
122 unsigned int radius = (
unsigned int)distancemap(*it);
129 itball != itendball; itball++)
130 if (imageGranulo.
domain().isInside(*itball) &&
131 ( ball(*itball) > 0) &&
132 (imageGranulo(*itball) < radius))
133 imageGranulo.
setValue(*itball, radius);
139 trace.
info() <<
"Granulometry ok nbBalls="<<cpt<< std::endl;
152 itend = imageGranulo.
domain().end(); it != itend;
154 if (imageGranulo(*it) > 0)
159 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
160 trace.
info() <<
"viewer3 launched..."<<std::endl;
Aim: implements separable l_p metrics with exact predicates.
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const
std::vector< Value >::const_iterator ConstIterator
std::vector< Value >::iterator Iterator
Aim: implements association bewteen points lying in a digital domain and values.
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.
static Self diagonal(Component val=1)
void show() override
Starts the event loop and display of elements.
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.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Export a 3D Image using the Vol formats.
Attach a property to an element.
Functor that rounds down.