Example of use the FMM (fast marching method) class in 3D.
#include <iostream>
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include "ConfigExamples.h"
#include "DGtal/io/viewers/Viewer3D.h"
using namespace Z3i;
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/images/ImageContainerBySTLMap.h"
#include "DGtal/images/ConstImageAdapter.h"
#include "DGtal/base/BasicFunctors.h"
#include "DGtal/kernel/BasicPointPredicates.h"
#include "DGtal/topology/SurfelAdjacency.h"
#include "DGtal/topology/helpers/FrontierPredicate.h"
#include "DGtal/topology/LightExplicitDigitalSurface.h"
#include "DGtal/geometry/volumes/distance/FMM.h"
int main(
int argc,
char** argv )
{
int t =0;
double maximalDistance = 3.0;
std::string imageFileName = examplesPath + "samples/Al.100.vol";
trace.
emphase() << imageFileName <<std::endl;
BinaryImage binaryImage(labelImage, labelImage.domain(), g, thresholder);
trace.
info() <<
"threshold: "
<< t
<< std::endl;
KSpace::SCell bel;
try {
trace.
info() <<
"starting bel: "
<< bel
<< std::endl;
trace.
emphase() <<
"starting bel not found" << std::endl;
return 0;
}
std::pair<Point,Point> bpair = functor(bel);
SurfelPredicate surfelPredicate( ks, binaryImage,
binaryImage( bpair.first ),
binaryImage( bpair.second ) );
Frontier frontier( ks, surfelPredicate,
typedef Domain::Predicate DomainPredicate;
DistanceImage imageDistance(
domain, 0.0 );
AcceptedPointSet initialPointSet( imageDistance );
FMM::initFromBelsRange( ks, frontier.begin(), frontier.end(),
imageDistance, initialPointSet, 0.5 );
FMM fmm( imageDistance, initialPointSet,
domain.predicate(),
domain.size(), maximalDistance );
trace.
info() << fmm << std::endl;
QApplication application(argc,argv);
for (DistanceImage::const_iterator it = imageDistance.begin(), itEnd = imageDistance.end();
it != itEnd; ++it)
{
viewer <<
CustomColors3D( colorMap(it->second), colorMap(it->second) ) ;
viewer << p;
}
Point p = Point::diagonal(1);
double a = -extent[0]/2, b = extent[1]/2;
double c = 0, mu = (a+b);
trace.
info() <<
"clipping plane ("
<< a << ", " << b << ", " << c << ", " << mu << ")"
<< std::endl;
viewer << Viewer3D<>::updateDisplay;
return application.exec();
}
Structure representing an RGB triple with alpha component.
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Aim: An adapter for viewing an associative image container like ImageContainerBySTLMap as a simple di...
Aim: Fast Marching Method (FMM) for nd distance transforms.
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 model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
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...
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...
Aim: The predicate on surfels that represents the frontier between two regions in an image....
Aim: transforms a signed cell c into a pair of points corresponding to the signed cells of greater di...
Aim: A small functor with an operator () that compares one value to a threshold value according to tw...
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: Define a simple default functor that just returns its argument.
FreemanChain< int >::Vector Vector
HyperRectDomain< Space > Domain