31 #if defined(DigitalSurfaceRegularization_RECURSES)
32 #error Recursive header files inclusion detected in DigitalSurfaceRegularization.h
33 #else // defined(DigitalSurfaceRegularization_RECURSES)
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"
511 #endif // !defined DigitalSurfaceRegularization_h
513 #undef DigitalSurfaceRegularization_RECURSES
514 #endif // else defined(DigitalSurfaceRegularization_RECURSES)
const Positions & getRegularizedPositions() const
std::map< Cell, IdxVertex > Cell2Index
void selfDisplay(std::ostream &out) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
LightDigitalSurface::Cell Cell
DigitalSurfaceRegularization(CountedPtr< DigSurface > aDigSurf)
double myAlpha
Data attachment term coefficient.
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.
ShortcutsGeometry< Z3i::KSpace > SHG3
We rely on the ShortcutsGeometry 3D types.
bool myConstantCoeffs
Flag if the gradient has constant weights for the init method and gradient.
DigitalSurfaceRegularization(const DigitalSurfaceRegularization &other)=delete
const SH3::Surfel2Index & getSurfelIndex() const
void init(const double alpha=0.001, const double beta=1.0, const double gamma=0.05)
Initialize the parameters of the energy function.
std::map< Surfel, IdxSurfel > Surfel2Index
const std::vector< double > * myGammas
Fairness attachment term local coefficients.
Shortcuts< Z3i::KSpace > SH3
We rely on the Shortcuts 3D types.
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
Positions myOriginalPositions
Copy of the input pointels positions.
SH3::PolygonalSurface::FaceRange myFaces
All faces of the dual digital surfacce.
std::vector< SH3::Cell > myAlignPointels
Adjacent pointels for the Alignement energy term.
SH3::Cell2Index myPointelIndex
Indices for pointels.
Aim: The digital surface container concept describes a minimal set of inner types and methods so as t...
~DigitalSurfaceRegularization()=default
void attachNormalVectors(const std::function< SHG3::RealVector(SH3::SCell &)> &normalFunc)
double myBeta
Alignment term coefficient.
static Parameters defaultParameters()
DigitalSurfaceRegularization(DigitalSurfaceRegularization &&other)=delete
Aim: Implements Digital Surface Regularization as described in .
TKSpace KSpace
Digital cellular space.
std::vector< Face > FaceRange
const SH3::Cell2Index & getCellIndex() const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::vector< Z3i::RealVector > Normals
Pointels position container.
void attachConvolvedTrivialNormalVectors(const Parameters someParams=SH3::defaultParameters()|SHG3::defaultParameters())
double myGamma
Fairness term coefficient.
DigitalSurfaceRegularization & operator=(const DigitalSurfaceRegularization &other)=delete
CountedPtr< DigSurface > myDigitalSurface
Input DigitalSurface to regularize.
double computeGradientLocalWeights()
const std::vector< double > * myAlphas
Data attachment term local coefficients.
const Normals & getNormalVectors() const
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
LightDigitalSurface::SCell SCell
TDigitalSurface DigSurface
DigitalSurface type.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
TDigitalSurface::DigitalSurfaceContainer DigitalSurfaceContainer
Digital Surface Container type.
const Positions & getOriginalPositions() const
Positions myGradient
Gradient of the energy w.r.t. vertex positons.
SH3::KSpace myK
Instance of the KSpace.
std::vector< unsigned char > myNbAdjacent
Number of adjacent faces to given vertex.
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Positions myGradientAlign
Internal members to store precomputed topological informations.
Aim: Implements basic operations that will be used in Point and Vector classes.
static Parameters defaultParameters()
bool myVerbose
Flag for verbose messages.
SHG3::RealPoint getRegularizedPosition(const SH3::Cell &aPointel)
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 > * myBetas
Alignment attachment term local coefficients.
SH3::Surfel2Index mySurfelIndex
Surfel Index.
SH3::SurfelRange mySurfels
Indexed surface elements.
bool myInit
Flag if the object has been set up properly.
Positions myRegularizedPositions
Regularized vertices.
double regularize(const unsigned int nbIters, const double dt, const double epsilon, const AdvectionFunction &advectionFunc)
Main regularization loop.
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceContainer< DigitalSurfaceContainer >))
std::vector< Z3i::RealPoint > Positions
Pointels position container.
double regularize(const unsigned int nbIters=200, const double dt=1.0, const double epsilon=0.0001)
Main regularization loop.
std::vector< SH3::Idx > myFairnessPointelsIdx
Indices of cells foor the Fairness term.
Normals myNormals
Normals.
std::vector< unsigned char > myNumberAdjEdgesToPointel
Number of adjacent edges to pointels.