31 #if defined(DigitalSurfaceRegularization_RECURSES)
32 #error Recursive header files inclusion detected in DigitalSurfaceRegularization.h
35 #define DigitalSurfaceRegularization_RECURSES
37 #if !defined DigitalSurfaceRegularization_h
39 #define DigitalSurfaceRegularization_h
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/topology/DigitalSurface.h"
48 #include "DGtal/helpers/StdDefs.h"
49 #include "DGtal/helpers/Shortcuts.h"
50 #include "DGtal/helpers/ShortcutsGeometry.h"
87 template <
typename TDigitalSurface>
184 void init(
const double alpha = 0.001,
185 const double beta = 1.0,
186 const double gamma = 0.05);
251 template <
typename AdvectionFunction>
254 const double epsilon,
255 const AdvectionFunction & advectionFunc);
274 const double dt = 1.0,
275 const double epsilon = 0.0001)
297 for(
auto i=0; i < 3; ++i)
298 if ((p[i]-orig[i])> 0.5) p[i]=orig[i]+0.5;
300 if ((p[i]-orig[i])< -0.5) p[i]=orig[i]-0.5;
313 ASSERT_MSG(
myInit,
"The init() method must be called first.");
314 ASSERT_MSG(
myK.uDim(aPointel) == 0,
"The cell must be a pointel (0-cell)");
325 ASSERT_MSG(
myInit,
"The init() method must be called first.");
335 ASSERT_MSG(
myInit,
"The init() method must be called first.");
345 ASSERT_MSG(
myInit,
"The init() method must be called first.");
355 ASSERT_MSG(
myInit,
"The init() method must be called first.");
366 ASSERT_MSG(
myInit,
"The init() method must be called first.");
376 ASSERT_MSG(
myInit,
"The init() method must be called first.");
498 template <
typename T>
507 #include "DGtal/geometry/surfaces/DigitalSurfaceRegularization.ih"
513 #undef DigitalSurfaceRegularization_RECURSES
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: Implements Digital Surface Regularization as described in .
Positions myOriginalPositions
Copy of the input pointels positions.
Positions myRegularizedPositions
Regularized vertices.
const std::vector< double > * myBetas
Alignment attachment term local coefficients.
static void clampedAdvection(SHG3::RealPoint &p, const SHG3::RealPoint &orig, const SHG3::RealVector &v)
std::vector< SH3::Idx > myAlignPointelsIdx
Indices of adjacent pointels for the Alignement energy term.
void init(const double alpha=0.001, const double beta=1.0, const double gamma=0.05)
Initialize the parameters of the energy function.
bool myConstantCoeffs
Flag if the gradient has constant weights for the init method and gradient.
void attachConvolvedTrivialNormalVectors(const Parameters someParams=SH3::defaultParameters()|SHG3::defaultParameters())
std::vector< SH3::Cell > myAlignPointels
Adjacent pointels for the Alignement energy term.
SH3::KSpace myK
Instance of the KSpace.
SH3::SurfelRange mySurfels
Indexed surface elements.
Positions myGradientAlign
Internal members to store precomputed topological informations.
const Normals & getNormalVectors() const
bool myVerbose
Flag for verbose messages.
std::vector< SH3::Idx > myFairnessPointelsIdx
Indices of cells foor the Fairness term.
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceContainer< DigitalSurfaceContainer >))
ShortcutsGeometry< Z3i::KSpace > SHG3
We rely on the ShortcutsGeometry 3D types.
const Positions & getOriginalPositions() const
double myAlpha
Data attachment term coefficient.
CountedPtr< DigSurface > myDigitalSurface
Input DigitalSurface to regularize.
bool myInit
Flag if the object has been set up properly.
~DigitalSurfaceRegularization()=default
std::vector< Z3i::RealPoint > Positions
Pointels position container.
Normals myNormals
Normals.
double myGamma
Fairness term coefficient.
Shortcuts< Z3i::KSpace > SH3
We rely on the Shortcuts 3D types.
std::vector< Z3i::RealVector > Normals
Pointels position container.
void attachNormalVectors(const std::function< SHG3::RealVector(SH3::SCell &)> &normalFunc)
std::vector< unsigned char > myNumberAdjEdgesToPointel
Number of adjacent edges to pointels.
DigitalSurfaceRegularization(DigitalSurfaceRegularization &&other)=delete
const Positions & getRegularizedPositions() const
DigitalSurfaceRegularization & operator=(const DigitalSurfaceRegularization &other)=delete
const SH3::Surfel2Index & getSurfelIndex() const
SH3::Cell2Index myPointelIndex
Indices for pointels.
Positions myGradient
Gradient of the energy w.r.t. vertex positons.
SHG3::RealPoint getRegularizedPosition(const SH3::Cell &aPointel)
void selfDisplay(std::ostream &out) const
double regularize(const unsigned int nbIters=200, const double dt=1.0, const double epsilon=0.0001)
Main regularization loop.
void init(ConstAlias< std::vector< double > > alphas, ConstAlias< std::vector< double > > betas, ConstAlias< std::vector< double > > gammas)
Initialize the parameters of the energy function.
const std::vector< double > * myAlphas
Data attachment term local coefficients.
double myBeta
Alignment term coefficient.
double regularize(const unsigned int nbIters, const double dt, const double epsilon, const AdvectionFunction &advectionFunc)
Main regularization loop.
SH3::PolygonalSurface::FaceRange myFaces
All faces of the dual digital surfacce.
DigitalSurfaceRegularization(CountedPtr< DigSurface > aDigSurf)
const std::vector< double > * myGammas
Fairness attachment term local coefficients.
std::vector< unsigned char > myNbAdjacent
Number of adjacent faces to given vertex.
DigitalSurfaceRegularization(const DigitalSurfaceRegularization &other)=delete
const SH3::Cell2Index & getCellIndex() const
double computeGradientLocalWeights()
SH3::Surfel2Index mySurfelIndex
Surfel Index.
TDigitalSurface DigSurface
DigitalSurface type.
TDigitalSurface::DigitalSurfaceContainer DigitalSurfaceContainer
Digital Surface Container type.
Aim: Implements basic operations that will be used in Point and Vector classes.
std::vector< Face > FaceRange
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...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
std::map< Surfel, IdxSurfel > Surfel2Index
std::map< Cell, IdxVertex > Cell2Index
static Parameters defaultParameters()
TKSpace KSpace
Digital cellular space.
LightDigitalSurface::SCell SCell
LightDigitalSurface::Cell Cell
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: The digital surface container concept describes a minimal set of inner types and methods so as t...