32#include "DGtal/base/Common.h"
34#include "ConfigExamples.h"
37#include "DGtal/images/ImageContainerBySTLVector.h"
38#include "DGtal/images/ImageContainerBySTLMap.h"
39#include "DGtal/base/BasicFunctors.h"
40#include "DGtal/kernel/BasicPointPredicates.h"
43#include "DGtal/io/readers/VolReader.h"
44#include "DGtal/io/writers/VolWriter.h"
47#include "DGtal/topology/SurfelAdjacency.h"
48#include "DGtal/topology/helpers/FrontierPredicate.h"
49#include "DGtal/topology/LightExplicitDigitalSurface.h"
52#include "DGtal/geometry/volumes/distance/FMM.h"
64int main(
int argc,
char** argv )
68 for (
int i = 0; i < argc; ++i )
75 string imageFileName = examplesPath +
"samples/cat10.vol";
76 trace.
info() << imageFileName <<std::endl;
95 trace.
info() <<
"starting bel: " << bel << std::endl;
98 trace.
emphase() <<
"starting bel not found" << std::endl;
112 std::pair<Point,Point> bpair = toIncidentPoints( bel );
113 SurfelPredicate surfelPredicate( ks, binaryImage,
114 binaryImage( bpair.first ),
115 binaryImage( bpair.second ) );
116 Frontier frontier( ks, surfelPredicate,
122 const double maximalDistance = 3.0;
133 DistanceImage imageDistance(
domain, 0.0 );
134 AcceptedPointSet pointSet( imageDistance );
136 for (Frontier::SurfelConstIterator it = frontier.begin(), itEnd = frontier.end();
139 pointSet.insert( toInnerPoint(*it) );
140 imageDistance.setValue( toInnerPoint(*it), 0.5 );
145 FMM fmm( imageDistance, pointSet, binaryImage,
154 trace.
info() <<
"Erosion of radius: " << maximalDistance << std::endl;
157 for (AcceptedPointSet::ConstIterator it = pointSet.begin(), itEnd = pointSet.end();
160 binaryImage.setValue(*it, 0);
169 string outputFileName =
"eroded.vol";
170 trace.
info() <<
"to " << outputFileName << std::endl;
Aim: An adapter for viewing an associative image container like ImageContainerBySTLMap as a simple di...
Aim: Fast Marching Method (FMM) for nd distance transforms.
const Point & lowerBound() const
const Point & upperBound() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
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: transforms a signed cell c into a point corresponding to the signed cell of greater dimension th...
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Export a 3D Image using the Vol formats.