32#include <unordered_map>
33#include "ConfigExamples.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/base/Common.h"
36#include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.h"
37#include "DGtal/geometry/surfaces/estimation/PlaneProbingParallelepipedEstimator.h"
38#include "DGtal/geometry/surfaces/DigitalSurfacePredicate.h"
39#include "DGtal/geometry/surfaces/estimation/PlaneProbingDigitalSurfaceLocalEstimator.h"
40#include "DGtal/helpers/Shortcuts.h"
41#include "DGtal/helpers/ShortcutsGeometry.h"
42#include "DGtal/io/viewers/PolyscopeViewer.h"
55using Integer = Point::Coordinate;
61 Point p =
K.uCoords(pointels[0]),
62 u =
K.uCoords(pointels[1]) - p,
63 v =
K.uCoords(pointels[3]) - p;
65 static const RealPoint shift(-0.5, -0.5, -0.5);
67 return p + 0.5 * u + 0.5 * v + shift;
72int main(
int argc,
char** argv )
74 std::string volfile = (argc > 1) ? argv[1] : (examplesPath +
"samples/cat10.vol");
83 double gridstep = params[
"gridstep"].as<
double>();
95 Estimator::ProbingFactory probingFactory = [&bound](
const Estimator::ProbingFrame& frame,
const SurfacePredicate& surfacePredicate) {
100 return new ProbingAlgorithm(frame.p, { frame.b1, frame.b2, frame.normal }, surfacePredicate, bound);
104 std::unordered_map<Surfel, RealPoint> preEstimations;
117 estimator.init(gridstep, surfels.begin(), surfels.end());
122 std::vector<Estimator::Quantity> quantities;
123 estimator.eval(surfels.begin(), surfels.end(), std::back_inserter(quantities));
130 for (
auto it = surfels.begin(); it != surfels.end(); ++it, ++i)
137 viewer.drawColor(fillColor);
141 RealPoint const& preEstimation = estimator.getPreEstimation(it);
143 viewer.drawLine(origin, origin + 1.5 * preEstimation.
getNormalized());
72int main(
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
Aim: A point predicate which tells whether a point belongs to the set of pointels of a given digital ...
Aim: Adapt a plane-probing estimator on a digital surface to estimate normal vectors.
typename TetrahedronEstimator::Quantity Quantity
PointVector< dim, double, std::array< double, dim > > getNormalized() const
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static Parameters defaultParameters()
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
LightDigitalSurface::Surfel Surfel
Space::RealPoint RealPoint
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CellRange getPrimalVertices(const KSpace &K, const SCell &s)
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters ¶ms=parametersDigitalSurface())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface
static Parameters defaultParameters()
LightDigitalSurface::SCell SCell
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
CountedPtr< SH3::DigitalSurface > surface
SH3::DigitalSurface Surface
PlaneProbingParallelepipedEstimator< DigitalPlane, ProbingMode::R1 > Estimator
Point::Coordinate Integer
RealPoint centerSurfel(KSpace const &K, SH3::SCell const &s)
KhalimskySpaceND< 3, Integer > KSpace
DGtal is the top-level namespace which contains all DGtal functions and types.
ShortcutsGeometry< Z3i::KSpace > SHG3
PointVector< 3, double > RealPoint