File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::Shortcuts< TKSpace > Class Template Reference

Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes and surface with few lines of code. The drawback is that you use specific types or objects, which could lead to faster code or more compact data structures. More...

#include <DGtal/helpers/Shortcuts.h>

Inheritance diagram for DGtal::Shortcuts< TKSpace >:
[legend]

Data Structures

struct  CellReader
struct  CellWriter
struct  SCellReader
struct  SCellWriter
struct  ValueReader
struct  ValueWriter

Public Types

typedef TKSpace KSpace
 Digital cellular space.
typedef KSpace::Space Space
 Digital space.
typedef Space::Integer Integer
 Integer numbers.
typedef Space::Point Point
 Point with integer coordinates.
typedef Space::Vector Vector
 Vector with integer coordinates.
typedef Space::RealVector RealVector
 Vector with floating-point coordinates.
typedef Space::RealPoint RealPoint
 Point with floating-point coordinates.
typedef RealVector::Component Scalar
 Floating-point numbers.
typedef HyperRectDomain< SpaceDomain
 An (hyper-)rectangular domain.
typedef unsigned char GrayScale
 The type for 8-bits gray-scale elements.
typedef MPolynomial< Space::dimension, ScalarScalarPolynomial
 defines a multi-variate polynomial : RealPoint -> Scalar
typedef ImplicitPolynomial3Shape< SpaceImplicitShape3D
typedef GaussDigitizer< Space, ImplicitShape3DDigitizedImplicitShape3D
 defines the digitization of an implicit shape.
typedef ImageContainerBySTLVector< Domain, bool > BinaryImage
 defines a black and white image with (hyper-)rectangular domain.
typedef ImageContainerBySTLVector< Domain, GrayScaleGrayScaleImage
 defines a grey-level image with (hyper-)rectangular domain.
typedef ImageContainerBySTLVector< Domain, float > FloatImage
 defines a float image with (hyper-)rectangular domain.
typedef ImageContainerBySTLVector< Domain, double > DoubleImage
 defines a double image with (hyper-)rectangular domain.
typedef KSpace::SurfelSet SurfelSet
 defines a set of surfels
typedef LightImplicitDigitalSurface< KSpace, BinaryImageLightSurfaceContainer
typedef ::DGtal::DigitalSurface< LightSurfaceContainerLightDigitalSurface
 defines a connected digital surface over a binary image.
typedef SetOfSurfels< KSpace, SurfelSetExplicitSurfaceContainer
 defines a heavy container that represents any digital surface.
typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainerDigitalSurface
 defines an arbitrary digital surface over a binary image.
typedef IndexedDigitalSurface< ExplicitSurfaceContainerIdxDigitalSurface
 defines a connected or not indexed digital surface.
typedef LightDigitalSurface::Surfel Surfel
typedef LightDigitalSurface::Cell Cell
typedef LightDigitalSurface::SCell SCell
typedef LightDigitalSurface::Vertex Vertex
typedef LightDigitalSurface::Arc Arc
typedef LightDigitalSurface::Face Face
typedef LightDigitalSurface::ArcRange ArcRange
typedef IdxDigitalSurface::Vertex IdxSurfel
typedef IdxDigitalSurface::Vertex IdxVertex
typedef IdxDigitalSurface::Arc IdxArc
typedef IdxDigitalSurface::ArcRange IdxArcRange
typedef std::set< IdxSurfelIdxSurfelSet
typedef std::vector< SCellSCellRange
typedef std::vector< CellCellRange
typedef CellRange PointelRange
typedef SCellRange SurfelRange
typedef std::vector< IdxSurfelIdxSurfelRange
typedef std::vector< ScalarScalars
typedef std::vector< RealVectorRealVectors
typedef std::vector< RealPointRealPoints
typedef IdxVertex Idx
typedef std::vector< IdxVertexIdxRange
typedef ::DGtal::Mesh< RealPointMesh
typedef ::DGtal::TriangulatedSurface< RealPointTriangulatedSurface
typedef ::DGtal::PolygonalSurface< RealPointPolygonalSurface
typedef ::DGtal::SurfaceMesh< RealPoint, RealPointSurfaceMesh
typedef std::map< Surfel, IdxSurfelSurfel2Index
typedef std::map< Cell, IdxVertexCell2Index
typedef ::DGtal::Color Color
typedef std::vector< ColorColors
typedef GradientColorMap< ScalarColorMap
typedef TickedColorMap< Scalar, ColorMapZeroTickedColorMap

Public Member Functions

 Shortcuts ()=delete
 ~Shortcuts ()=delete
 Shortcuts (const Shortcuts &other)=delete
 Shortcuts (Shortcuts &&other)=delete
Shortcutsoperator= (const Shortcuts &other)=delete
Shortcutsoperator= (Shortcuts &&other)=delete
void selfDisplay (std::ostream &out) const
bool isValid () const

Static Public Member Functions

static Parameters defaultParameters ()
static std::map< std::string, std::string > getPolynomialList ()
static Parameters parametersImplicitShape3D ()
static CountedPtr< ImplicitShape3DmakeImplicitShape3D (const Parameters &params=parametersImplicitShape3D())
static Parameters parametersKSpace ()
static KSpace getKSpace (const Point &low, const Point &up, Parameters params=parametersKSpace())
static KSpace getKSpace (CountedPtr< BinaryImage > bimage, Parameters params=parametersKSpace())
static KSpace getKSpace (CountedPtr< GrayScaleImage > gimage, Parameters params=parametersKSpace())
template<typename TDigitalSurfaceContainer>
static KSpace getKSpace (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static KSpace getKSpace (CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static const KSpacerefKSpace (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static const KSpacerefKSpace (CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
static CanonicCellEmbedder< KSpacegetCellEmbedder (const KSpace &K)
static CanonicSCellEmbedder< KSpacegetSCellEmbedder (const KSpace &K)
static Parameters parametersDigitizedImplicitShape3D ()
static KSpace getKSpace (Parameters params=parametersKSpace()|parametersDigitizedImplicitShape3D())
static CountedPtr< DigitizedImplicitShape3DmakeDigitizedImplicitShape3D (CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static Parameters parametersBinaryImage ()
static CountedPtr< BinaryImagemakeBinaryImage (Domain shapeDomain)
static CountedPtr< BinaryImagemakeBinaryImage (CountedPtr< DigitizedImplicitShape3D > shape_digitization, Parameters params=parametersBinaryImage())
static CountedPtr< BinaryImagemakeBinaryImage (CountedPtr< DigitizedImplicitShape3D > shape_digitization, Domain shapeDomain, Parameters params=parametersBinaryImage())
static CountedPtr< BinaryImagemakeBinaryImage (CountedPtr< BinaryImage > bimage, Parameters params=parametersBinaryImage())
static CountedPtr< BinaryImagemakeBinaryImage (std::string input, Parameters params=parametersBinaryImage())
static CountedPtr< BinaryImagemakeBinaryImage (CountedPtr< GrayScaleImage > gray_scale_image, Parameters params=parametersBinaryImage())
static bool saveBinaryImage (CountedPtr< BinaryImage > bimage, std::string output)
static Parameters parametersGrayScaleImage ()
static CountedPtr< GrayScaleImagemakeGrayScaleImage (Domain aDomain)
static CountedPtr< GrayScaleImagemakeGrayScaleImage (std::string input)
static CountedPtr< GrayScaleImagemakeGrayScaleImage (CountedPtr< BinaryImage > binary_image, std::function< GrayScale(bool) > const &bool2grayscale=[](bool v) { return v ?(unsigned char) 255 :(unsigned char) 0;})
static bool saveGrayScaleImage (CountedPtr< GrayScaleImage > gray_scale_image, std::string output)
static CountedPtr< GrayScaleImagemakeGrayScaleImage (CountedPtr< FloatImage > fimage, Parameters params=parametersGrayScaleImage())
static CountedPtr< GrayScaleImagemakeGrayScaleImage (CountedPtr< DoubleImage > fimage, Parameters params=parametersGrayScaleImage())
static CountedPtr< FloatImagemakeFloatImage (Domain aDomain)
static CountedPtr< FloatImagemakeFloatImage (std::string input)
static CountedPtr< FloatImagemakeFloatImage (CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static CountedPtr< DoubleImagemakeDoubleImage (Domain aDomain)
static CountedPtr< DoubleImagemakeDoubleImage (std::string input)
static CountedPtr< DoubleImagemakeDoubleImage (CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static Parameters parametersDigitalSurface ()
template<typename TDigitalSurfaceContainer>
static CanonicCellEmbedder< KSpacegetCellEmbedder (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static CanonicSCellEmbedder< KSpacegetSCellEmbedder (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static CanonicCellEmbedder< KSpacegetCellEmbedder (CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static CanonicSCellEmbedder< KSpacegetSCellEmbedder (CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
static CountedPtr< LightDigitalSurfacemakeLightDigitalSurface (CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
static std::vector< CountedPtr< LightDigitalSurface > > makeLightDigitalSurfaces (CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
static std::vector< CountedPtr< LightDigitalSurface > > makeLightDigitalSurfaces (SurfelRange &surfel_reps, CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
template<typename TPointPredicate>
static CountedPtr< DigitalSurfacemakeDigitalSurface (CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
static CountedPtr< DigitalSurfacemakeDigitalSurface (CountedPtr< IdxDigitalSurface > idx_surface, const Parameters &params=parametersDigitalSurface())
static CountedPtr< IdxDigitalSurfacemakeIdxDigitalSurface (CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
template<typename TSurfelRange>
static CountedPtr< IdxDigitalSurfacemakeIdxDigitalSurface (const TSurfelRange &surfels, ConstAlias< KSpace > K, const Parameters &params=parametersDigitalSurface())
template<typename TDigitalSurfaceContainer>
static CountedPtr< IdxDigitalSurfacemakeIdxDigitalSurface (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
static CountedPtr< IdxDigitalSurfacemakeIdxDigitalSurface (const std::vector< CountedPtr< LightDigitalSurface > > &surfaces, const Parameters &params=parametersDigitalSurface())
template<typename TDigitalSurfaceContainer>
static CellRange getCellRange (Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Dimension k)
template<typename TDigitalSurfaceContainer>
static PointelRange getCellRange (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Dimension k)
template<typename TDigitalSurfaceContainer>
static PointelRange getPointelRange (Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
template<typename TDigitalSurfaceContainer>
static PointelRange getPointelRange (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
static PointelRange getPointelRange (const KSpace &K, const SCell &surfel)
template<typename TDigitalSurfaceContainer>
static SurfelRange getSurfelRange (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
template<typename TDigitalSurfaceContainer>
static SurfelRange getSurfelRange (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Surfel &start_surfel, const Parameters &params=parametersDigitalSurface())
static IdxSurfelRange getIdxSurfelRange (CountedPtr< IdxDigitalSurface > surface, const Parameters &params=parametersDigitalSurface())
static IdxSurfelRange getIdxSurfelRange (CountedPtr< IdxDigitalSurface > surface, const IdxSurfel &start_surfel, const Parameters &params=parametersDigitalSurface())
template<typename TDigitalSurfaceContainer, typename TCellEmbedder>
static bool saveOFF (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, std::string off_file, const Color &face_color=DGtal::Color::None)
template<typename TDigitalSurfaceContainer, typename TCellEmbedder>
static bool saveOBJ (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
template<typename TDigitalSurfaceContainer>
static bool saveOBJ (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
template<typename TDigitalSurfaceContainer>
static bool saveOFF (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, std::string off_file, const Color &face_color=Color(32, 32, 32))
template<typename TDigitalSurfaceContainer>
static bool saveOBJ (CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static bool saveVectorFieldOBJ (const RealPoints &positions, const RealVectors &vf, double thickness, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static Parameters parametersMesh ()
static CountedPtr< TriangulatedSurfacemakeTriangulatedSurface (CountedPtr< Mesh > aMesh)
static CountedPtr< MeshmakeMesh (CountedPtr< TriangulatedSurface > triSurf, const Color &aColor=Color::White)
static CountedPtr< MeshmakeMesh (CountedPtr< PolygonalSurface > polySurf, const Color &aColor=Color::White)
template<typename TContainer>
static CountedPtr< TriangulatedSurfacemakeTriangulatedSurface (Surfel2Index &s2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< TriangulatedSurfacemakeTriangulatedSurface (CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
static CountedPtr< TriangulatedSurfacemakeTriangulatedSurface (CountedPtr< PolygonalSurface > polySurf, const Parameters &params=parametersMesh())
static CountedPtr< PolygonalSurfacemakePolygonalSurface (CountedPtr< Mesh > aMesh)
static CountedPtr< PolygonalSurfacemakePolygonalSurface (CountedPtr< GrayScaleImage > gray_scale_image, const Parameters &params=parametersKSpace()|parametersBinaryImage()|parametersDigitalSurface())
static CountedPtr< TriangulatedSurfacemakeTriangulatedSurface (CountedPtr< GrayScaleImage > gray_scale_image, const Parameters &params=parametersKSpace()|parametersBinaryImage()|parametersDigitalSurface())
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakeDualPolygonalSurface (Surfel2Index &s2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakeDualPolygonalSurface (CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakeDualPolygonalSurface (CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakePrimalPolygonalSurface (Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakePrimalPolygonalSurface (CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< PolygonalSurfacemakePrimalPolygonalSurface (CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< SurfaceMeshmakePrimalSurfaceMesh (Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< SurfaceMeshmakePrimalSurfaceMesh (CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
template<typename TContainer>
static CountedPtr< SurfaceMeshmakePrimalSurfaceMesh (CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
static CountedPtr< SurfaceMeshmakeSurfaceMesh (const std::string &path)
template<typename TPoint, typename TVector>
static bool saveOBJ (CountedPtr< ::DGtal::SurfaceMesh< TPoint, TVector > > surf, const std::string &objfile)
template<typename TPoint>
static bool saveOBJ (CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf, const std::string &objfile)
template<typename TPoint>
static bool saveOFF (CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf, std::string off_file, const Color &face_color=DGtal::Color::None)
template<typename TPoint>
static bool saveOBJ (CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf, const std::string &objfile)
template<typename TPoint>
static bool saveOBJ (CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
template<typename TPoint>
static bool saveOBJ (CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
template<typename TPoint, typename TVector>
static bool saveOBJ (CountedPtr< ::DGtal::SurfaceMesh< TPoint, TVector > > surf, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
template<typename TPoint>
static bool saveOFF (CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf, std::string off_file, const Color &face_color=DGtal::Color::None)
static Parameters parametersUtilities ()
template<typename TValue>
static IdxRange getRangeMatch (const std::vector< TValue > &s1, const std::vector< TValue > &s2, bool perfect=false)
template<typename TValue>
static std::vector< TValue > getMatchedRange (const std::vector< TValue > &range, const IdxRange &match)
static ColorMap getColorMap (Scalar min, Scalar max, const Parameters &params=parametersUtilities())
static ZeroTickedColorMap getZeroTickedColorMap (Scalar min, Scalar max, const Parameters &params=parametersUtilities())
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static bool outputSurfelsAsObj (std::ostream &output, const SurfelRange &surfels, const TCellEmbedder &embedder)
template<typename TAnyDigitalSurface>
static bool outputPrimalDigitalSurfaceAsObj (std::ostream &output, CountedPtr< TAnyDigitalSurface > surface)
template<typename TAnyDigitalSurface, typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static bool outputPrimalDigitalSurfaceAsObj (std::ostream &output, CountedPtr< TAnyDigitalSurface > surface, const TCellEmbedder &embedder)
static bool outputPrimalIdxDigitalSurfaceAsObj (std::ostream &output, CountedPtr< IdxDigitalSurface > surface)
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static bool outputPrimalIdxDigitalSurfaceAsObj (std::ostream &output, CountedPtr< IdxDigitalSurface > surface, const TCellEmbedder &embedder)
template<typename TDigitalSurfaceContainer>
static bool outputDualDigitalSurfaceAsObj (std::ostream &output, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersMesh())
template<typename TDigitalSurfaceContainer, typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static bool outputDualDigitalSurfaceAsObj (std::ostream &output, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const TCellEmbedder &embedder, const Parameters &params=parametersMesh())
template<typename TSCellMap, typename TValueWriter>
static bool outputSCellMapAsCSV (std::ostream &output, const KSpace &K, const TSCellMap &anyMap, const TValueWriter &writer)
template<typename TCellMap, typename TValueWriter>
static bool outputCellMapAsCSV (std::ostream &output, const KSpace &K, const TCellMap &anyMap, const TValueWriter &writer)
static CellRange getPrimalCells (const KSpace &K, const SCell &s, const Dimension k)
static CellRange getPrimalVertices (const KSpace &K, const SCell &s)
static CellRange getPrimalVertices (const KSpace &K, const Surfel &s, bool ccw)

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CCellularGridSpaceND< TKSpace >))

Detailed Description

template<typename TKSpace>
class DGtal::Shortcuts< TKSpace >

Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes and surface with few lines of code. The drawback is that you use specific types or objects, which could lead to faster code or more compact data structures.

Description of template class 'Shortcuts'

Template Parameters
TKSpaceany cellular grid space, a model of concepts::CCellularGridSpaceND like KhalimskySpaceND.
Examples
geometry/volumes/fullConvexityCollapsiblePoints2D.cpp, and geometry/volumes/fullConvexityLUT2D.cpp.

Definition at line 105 of file Shortcuts.h.

Member Typedef Documentation

â—† Arc

template<typename TKSpace>
typedef LightDigitalSurface::Arc DGtal::Shortcuts< TKSpace >::Arc

Definition at line 166 of file Shortcuts.h.

â—† ArcRange

template<typename TKSpace>
typedef LightDigitalSurface::ArcRange DGtal::Shortcuts< TKSpace >::ArcRange

Definition at line 168 of file Shortcuts.h.

â—† BinaryImage

template<typename TKSpace>
typedef ImageContainerBySTLVector<Domain, bool> DGtal::Shortcuts< TKSpace >::BinaryImage

defines a black and white image with (hyper-)rectangular domain.

Definition at line 142 of file Shortcuts.h.

â—† Cell

template<typename TKSpace>
typedef LightDigitalSurface::Cell DGtal::Shortcuts< TKSpace >::Cell

Definition at line 163 of file Shortcuts.h.

â—† Cell2Index

template<typename TKSpace>
typedef std::map<Cell, IdxVertex> DGtal::Shortcuts< TKSpace >::Cell2Index

Definition at line 190 of file Shortcuts.h.

â—† CellRange

template<typename TKSpace>
typedef std::vector< Cell > DGtal::Shortcuts< TKSpace >::CellRange

Definition at line 175 of file Shortcuts.h.

â—† Color

template<typename TKSpace>
typedef ::DGtal::Color DGtal::Shortcuts< TKSpace >::Color

Definition at line 192 of file Shortcuts.h.

â—† ColorMap

template<typename TKSpace>
typedef GradientColorMap<Scalar> DGtal::Shortcuts< TKSpace >::ColorMap

Definition at line 194 of file Shortcuts.h.

â—† Colors

template<typename TKSpace>
typedef std::vector< Color > DGtal::Shortcuts< TKSpace >::Colors

Definition at line 193 of file Shortcuts.h.

â—† DigitalSurface

template<typename TKSpace>
typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainer > DGtal::Shortcuts< TKSpace >::DigitalSurface

defines an arbitrary digital surface over a binary image.

Definition at line 159 of file Shortcuts.h.

â—† DigitizedImplicitShape3D

template<typename TKSpace>
typedef GaussDigitizer< Space, ImplicitShape3D > DGtal::Shortcuts< TKSpace >::DigitizedImplicitShape3D

defines the digitization of an implicit shape.

Definition at line 140 of file Shortcuts.h.

â—† Domain

template<typename TKSpace>
typedef HyperRectDomain<Space> DGtal::Shortcuts< TKSpace >::Domain

An (hyper-)rectangular domain.

Definition at line 128 of file Shortcuts.h.

â—† DoubleImage

template<typename TKSpace>
typedef ImageContainerBySTLVector<Domain, double> DGtal::Shortcuts< TKSpace >::DoubleImage

defines a double image with (hyper-)rectangular domain.

Definition at line 148 of file Shortcuts.h.

â—† ExplicitSurfaceContainer

template<typename TKSpace>
typedef SetOfSurfels< KSpace, SurfelSet > DGtal::Shortcuts< TKSpace >::ExplicitSurfaceContainer

defines a heavy container that represents any digital surface.

Definition at line 157 of file Shortcuts.h.

â—† Face

template<typename TKSpace>
typedef LightDigitalSurface::Face DGtal::Shortcuts< TKSpace >::Face

Definition at line 167 of file Shortcuts.h.

â—† FloatImage

template<typename TKSpace>
typedef ImageContainerBySTLVector<Domain, float> DGtal::Shortcuts< TKSpace >::FloatImage

defines a float image with (hyper-)rectangular domain.

Definition at line 146 of file Shortcuts.h.

â—† GrayScale

template<typename TKSpace>
typedef unsigned char DGtal::Shortcuts< TKSpace >::GrayScale

The type for 8-bits gray-scale elements.

Definition at line 130 of file Shortcuts.h.

â—† GrayScaleImage

template<typename TKSpace>
typedef ImageContainerBySTLVector<Domain, GrayScale> DGtal::Shortcuts< TKSpace >::GrayScaleImage

defines a grey-level image with (hyper-)rectangular domain.

Definition at line 144 of file Shortcuts.h.

â—† Idx

template<typename TKSpace>
typedef IdxVertex DGtal::Shortcuts< TKSpace >::Idx

Definition at line 182 of file Shortcuts.h.

â—† IdxArc

template<typename TKSpace>
typedef IdxDigitalSurface::Arc DGtal::Shortcuts< TKSpace >::IdxArc

Definition at line 171 of file Shortcuts.h.

â—† IdxArcRange

template<typename TKSpace>
typedef IdxDigitalSurface::ArcRange DGtal::Shortcuts< TKSpace >::IdxArcRange

Definition at line 172 of file Shortcuts.h.

â—† IdxDigitalSurface

template<typename TKSpace>
typedef IndexedDigitalSurface< ExplicitSurfaceContainer > DGtal::Shortcuts< TKSpace >::IdxDigitalSurface

defines a connected or not indexed digital surface.

Definition at line 161 of file Shortcuts.h.

â—† IdxRange

template<typename TKSpace>
typedef std::vector< IdxVertex > DGtal::Shortcuts< TKSpace >::IdxRange

Definition at line 183 of file Shortcuts.h.

â—† IdxSurfel

template<typename TKSpace>
typedef IdxDigitalSurface::Vertex DGtal::Shortcuts< TKSpace >::IdxSurfel

Definition at line 169 of file Shortcuts.h.

â—† IdxSurfelRange

template<typename TKSpace>
typedef std::vector< IdxSurfel > DGtal::Shortcuts< TKSpace >::IdxSurfelRange

Definition at line 178 of file Shortcuts.h.

â—† IdxSurfelSet

template<typename TKSpace>
typedef std::set< IdxSurfel > DGtal::Shortcuts< TKSpace >::IdxSurfelSet

Definition at line 173 of file Shortcuts.h.

â—† IdxVertex

template<typename TKSpace>
typedef IdxDigitalSurface::Vertex DGtal::Shortcuts< TKSpace >::IdxVertex

Definition at line 170 of file Shortcuts.h.

â—† ImplicitShape3D

template<typename TKSpace>
typedef ImplicitPolynomial3Shape<Space> DGtal::Shortcuts< TKSpace >::ImplicitShape3D

defines an implicit shape of the space, which is the zero-level set of a ScalarPolynomial.

Definition at line 138 of file Shortcuts.h.

â—† Integer

template<typename TKSpace>
typedef Space::Integer DGtal::Shortcuts< TKSpace >::Integer

Integer numbers.

Definition at line 116 of file Shortcuts.h.

â—† KSpace

template<typename TKSpace>
typedef TKSpace DGtal::Shortcuts< TKSpace >::KSpace

Digital cellular space.

Definition at line 112 of file Shortcuts.h.

â—† LightDigitalSurface

template<typename TKSpace>
typedef ::DGtal::DigitalSurface< LightSurfaceContainer > DGtal::Shortcuts< TKSpace >::LightDigitalSurface

defines a connected digital surface over a binary image.

Definition at line 155 of file Shortcuts.h.

â—† LightSurfaceContainer

template<typename TKSpace>
typedef LightImplicitDigitalSurface< KSpace, BinaryImage > DGtal::Shortcuts< TKSpace >::LightSurfaceContainer

defines a light container that represents a connected digital surface over a binary image.

Definition at line 153 of file Shortcuts.h.

â—† Mesh

template<typename TKSpace>
typedef ::DGtal::Mesh<RealPoint> DGtal::Shortcuts< TKSpace >::Mesh

Definition at line 185 of file Shortcuts.h.

â—† Point

template<typename TKSpace>
typedef Space::Point DGtal::Shortcuts< TKSpace >::Point

Point with integer coordinates.

Definition at line 118 of file Shortcuts.h.

â—† PointelRange

template<typename TKSpace>
typedef CellRange DGtal::Shortcuts< TKSpace >::PointelRange

Definition at line 176 of file Shortcuts.h.

â—† PolygonalSurface

template<typename TKSpace>
typedef ::DGtal::PolygonalSurface<RealPoint> DGtal::Shortcuts< TKSpace >::PolygonalSurface

Definition at line 187 of file Shortcuts.h.

â—† RealPoint

template<typename TKSpace>
typedef Space::RealPoint DGtal::Shortcuts< TKSpace >::RealPoint

Point with floating-point coordinates.

Definition at line 124 of file Shortcuts.h.

â—† RealPoints

template<typename TKSpace>
typedef std::vector< RealPoint > DGtal::Shortcuts< TKSpace >::RealPoints

Definition at line 181 of file Shortcuts.h.

â—† RealVector

template<typename TKSpace>
typedef Space::RealVector DGtal::Shortcuts< TKSpace >::RealVector

Vector with floating-point coordinates.

Definition at line 122 of file Shortcuts.h.

â—† RealVectors

template<typename TKSpace>
typedef std::vector< RealVector > DGtal::Shortcuts< TKSpace >::RealVectors

Definition at line 180 of file Shortcuts.h.

â—† Scalar

template<typename TKSpace>
typedef RealVector::Component DGtal::Shortcuts< TKSpace >::Scalar

Floating-point numbers.

Definition at line 126 of file Shortcuts.h.

â—† ScalarPolynomial

template<typename TKSpace>
typedef MPolynomial< Space::dimension, Scalar > DGtal::Shortcuts< TKSpace >::ScalarPolynomial

defines a multi-variate polynomial : RealPoint -> Scalar

Definition at line 135 of file Shortcuts.h.

â—† Scalars

template<typename TKSpace>
typedef std::vector< Scalar > DGtal::Shortcuts< TKSpace >::Scalars

Definition at line 179 of file Shortcuts.h.

â—† SCell

template<typename TKSpace>
typedef LightDigitalSurface::SCell DGtal::Shortcuts< TKSpace >::SCell

Definition at line 164 of file Shortcuts.h.

â—† SCellRange

template<typename TKSpace>
typedef std::vector< SCell > DGtal::Shortcuts< TKSpace >::SCellRange

Definition at line 174 of file Shortcuts.h.

â—† Space

template<typename TKSpace>
typedef KSpace::Space DGtal::Shortcuts< TKSpace >::Space

Digital space.

Definition at line 114 of file Shortcuts.h.

â—† SurfaceMesh

template<typename TKSpace>
typedef ::DGtal::SurfaceMesh<RealPoint,RealPoint> DGtal::Shortcuts< TKSpace >::SurfaceMesh

Definition at line 188 of file Shortcuts.h.

â—† Surfel

template<typename TKSpace>
typedef LightDigitalSurface::Surfel DGtal::Shortcuts< TKSpace >::Surfel

Definition at line 162 of file Shortcuts.h.

â—† Surfel2Index

template<typename TKSpace>
typedef std::map<Surfel, IdxSurfel> DGtal::Shortcuts< TKSpace >::Surfel2Index

Definition at line 189 of file Shortcuts.h.

â—† SurfelRange

template<typename TKSpace>
typedef SCellRange DGtal::Shortcuts< TKSpace >::SurfelRange

Definition at line 177 of file Shortcuts.h.

â—† SurfelSet

template<typename TKSpace>
typedef KSpace::SurfelSet DGtal::Shortcuts< TKSpace >::SurfelSet

defines a set of surfels

Definition at line 150 of file Shortcuts.h.

â—† TriangulatedSurface

template<typename TKSpace>
typedef ::DGtal::TriangulatedSurface<RealPoint> DGtal::Shortcuts< TKSpace >::TriangulatedSurface

Definition at line 186 of file Shortcuts.h.

â—† Vector

template<typename TKSpace>
typedef Space::Vector DGtal::Shortcuts< TKSpace >::Vector

Vector with integer coordinates.

Definition at line 120 of file Shortcuts.h.

â—† Vertex

template<typename TKSpace>
typedef LightDigitalSurface::Vertex DGtal::Shortcuts< TKSpace >::Vertex

Definition at line 165 of file Shortcuts.h.

â—† ZeroTickedColorMap

template<typename TKSpace>
typedef TickedColorMap<Scalar,ColorMap> DGtal::Shortcuts< TKSpace >::ZeroTickedColorMap

Definition at line 195 of file Shortcuts.h.

Constructor & Destructor Documentation

â—† Shortcuts() [1/3]

template<typename TKSpace>
DGtal::Shortcuts< TKSpace >::Shortcuts ( )
delete

Default constructor.

â—† ~Shortcuts()

template<typename TKSpace>
DGtal::Shortcuts< TKSpace >::~Shortcuts ( )
delete

Destructor.

â—† Shortcuts() [2/3]

template<typename TKSpace>
DGtal::Shortcuts< TKSpace >::Shortcuts ( const Shortcuts< TKSpace > & other)
delete

Copy constructor.

Parameters
otherthe object to clone.

â—† Shortcuts() [3/3]

template<typename TKSpace>
DGtal::Shortcuts< TKSpace >::Shortcuts ( Shortcuts< TKSpace > && other)
delete

Move constructor.

Parameters
otherthe object to move.

Member Function Documentation

â—† BOOST_CONCEPT_ASSERT()

template<typename TKSpace>
DGtal::Shortcuts< TKSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CCellularGridSpaceND< TKSpace >) )
private

â—† defaultParameters()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::defaultParameters ( )
inlinestatic
Returns
the parameters and their default values used in shortcuts.

Definition at line 204 of file Shortcuts.h.

205 {
214 }
static Parameters parametersUtilities()
Definition Shortcuts.h:2676
static Parameters parametersImplicitShape3D()
Definition Shortcuts.h:266
static Parameters parametersKSpace()
Definition Shortcuts.h:312
static Parameters parametersMesh()
Definition Shortcuts.h:2037
static Parameters parametersDigitalSurface()
Definition Shortcuts.h:997
static Parameters parametersBinaryImage()
Definition Shortcuts.h:548
static Parameters parametersDigitizedImplicitShape3D()
Definition Shortcuts.h:462
static Parameters parametersGrayScaleImage()
Definition Shortcuts.h:724

â—† getCellEmbedder() [1/3]

â—† getCellEmbedder() [2/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CanonicCellEmbedder< KSpace > DGtal::Shortcuts< TKSpace >::getCellEmbedder ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
the canonic cell embedder associated to the given digital surface.

Definition at line 1011 of file Shortcuts.h.

1013 {
1014 return getCellEmbedder( refKSpace( surface ) );
1015 }
static const KSpace & refKSpace(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
Definition Shortcuts.h:420
static CanonicCellEmbedder< KSpace > getCellEmbedder(const KSpace &K)
Definition Shortcuts.h:439

â—† getCellEmbedder() [3/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CanonicCellEmbedder< KSpace > DGtal::Shortcuts< TKSpace >::getCellEmbedder ( CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on any indexed digital surface.
Returns
the canonic cell embedder associated to the given indexed digital surface.

Definition at line 1033 of file Shortcuts.h.

1035 {
1036 return getCellEmbedder( refKSpace( surface ) );
1037 }

â—† getCellRange() [1/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CellRange DGtal::Shortcuts< TKSpace >::getCellRange ( Cell2Index & c2i,
CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Dimension k )
inlinestatic

Given any digital surface, returns the vector of its k-dimensional cells.

Note
The order of cells is given by the default traversal of the surfels of the surface, where the cells of each surfel are visited in no specific order.
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[out]c2ithe map Cell -> Cell index in the cell range.
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
[in]kthe dimension of the output cells
Returns
a range of cells as a vector.

Definition at line 1399 of file Shortcuts.h.

1403 {
1405 // Approximate number of pointels given the number of 2-cells (valid for 2d surfaces in nD).
1406 result.reserve( 2 * surface->size() + 100 );
1407 const KSpace& K = refKSpace( surface );
1408 Idx n = 0;
1409 for ( auto&& surfel : *surface )
1410 {
1412 for ( auto&& primal_cell : primal_cells )
1413 {
1414 if ( ! c2i.count( primal_cell ) )
1415 {
1416 result.push_back( primal_cell );
1417 c2i[ primal_cell ] = n++;
1418 }
1419 }
1420 }
1421 return result;
1422 }
static CellRange getPrimalCells(const KSpace &K, const SCell &s, const Dimension k)
Definition Shortcuts.h:3247
std::vector< Cell > CellRange
Definition Shortcuts.h:175
IdxVertex Idx
Definition Shortcuts.h:182
TKSpace KSpace
Digital cellular space.
Definition Shortcuts.h:112

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getCellRange().

â—† getCellRange() [2/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
PointelRange DGtal::Shortcuts< TKSpace >::getCellRange ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Dimension k )
inlinestatic

Given any digital surface, returns the vector of its k-dimensional cells.

Note
The order of cells is given by the default traversal of the surfels of the surface, where the cells of each surfel are visited in no specific order.
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
[in]kthe dimension of the output cells
Returns
a range of cells as a vector.

Definition at line 1438 of file Shortcuts.h.

1442 {
1444 return getCellRange( c2i, surface, k );
1445 }
static CellRange getCellRange(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Dimension k)
Definition Shortcuts.h:1400
std::map< Cell, IdxVertex > Cell2Index
Definition Shortcuts.h:190

â—† getColorMap()

template<typename TKSpace>
ColorMap DGtal::Shortcuts< TKSpace >::getColorMap ( Scalar min,
Scalar max,
const Parameters & params = parametersUtilities() )
inlinestatic
Parameters
[in]minthe minimum considered value for the colormap.
[in]maxthe maximum considered value for the colormap.
[in]paramsthe parameters:
  • colormap [ "Custom" ]: "Cool"|"Copper"|"Hot"|"Jet"|"Spring"|"Summer"|"Autumn"|"Winter"|"Error"|"Custom" specifies standard colormaps (if invalid, falls back to "Custom").
Returns
a colormap according to the specified parameters

Definition at line 2751 of file Shortcuts.h.

2754 {
2755 std::string cmap = params[ "colormap" ].as<std::string>();
2756 if ( cmap == "Cool" ) return ColorMap( min, max, CMAP_COOL );
2757 else if ( cmap == "Copper" ) return ColorMap( min, max, CMAP_COPPER );
2758 else if ( cmap == "Hot" ) return ColorMap( min, max, CMAP_HOT );
2759 else if ( cmap == "Jet" ) return ColorMap( min, max, CMAP_JET );
2760 else if ( cmap == "Spring" ) return ColorMap( min, max, CMAP_SPRING );
2761 else if ( cmap == "Summer" ) return ColorMap( min, max, CMAP_SUMMER );
2762 else if ( cmap == "Autumn" ) return ColorMap( min, max, CMAP_AUTUMN );
2763 else if ( cmap == "Winter" ) return ColorMap( min, max, CMAP_WINTER );
2764 else if ( cmap == "Error" )
2765 {
2767 gradcmap.addColor( Color( 255, 255, 255 ) );
2768 gradcmap.addColor( Color( 255, 0, 0 ) );
2769 gradcmap.addColor( Color( 0, 0, 0 ) );
2770 return gradcmap;
2771 }
2772 // Custom colormap
2774 gradcmap.addColor( Color( 0, 0, 255 ) );
2775 gradcmap.addColor( Color( 0, 255, 255 ) );
2776 gradcmap.addColor( Color( 255, 255, 255 ) );
2777 gradcmap.addColor( Color( 255, 255, 0 ) );
2778 gradcmap.addColor( Color( 255, 0, 0 ) );
2779 return gradcmap;
2780 }
GradientColorMap< Scalar > ColorMap
Definition Shortcuts.h:194
::DGtal::Color Color
Definition Shortcuts.h:192

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getZeroTickedColorMap().

â—† getIdxSurfelRange() [1/2]

template<typename TKSpace>
IdxSurfelRange DGtal::Shortcuts< TKSpace >::getIdxSurfelRange ( CountedPtr< IdxDigitalSurface > surface,
const IdxSurfel & start_surfel,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Given an indexed digital surface, returns a vector of surfels in some specified order.

Parameters
[in]surfacea smart pointer on a digital surface.
[in]start_surfelthe surfel where the traversal starts in case of depth-first/breadth-first traversal.
[in]paramsthe parameters:
  • surfaceTraversal ["Default"]: "Default"|"DepthFirst"|"BreadthFirst": "Default" default surface traversal, "DepthFirst": depth-first surface traversal, "BreadthFirst": breadth-first surface traversal.
Returns
a range of indexed surfels as a vector.

Definition at line 1632 of file Shortcuts.h.

1636 {
1638 std::string traversal = params[ "surfaceTraversal" ].as<std::string>();
1639 if ( traversal == "DepthFirst" )
1640 {
1644 std::for_each( range.begin(), range.end(),
1645 [&result] ( IdxSurfel s ) { result.push_back( s ); } );
1646 }
1647 else if ( traversal == "BreadthFirst" )
1648 {
1652 std::for_each( range.begin(), range.end(),
1653 [&result] ( IdxSurfel s ) { result.push_back( s ); } );
1654 }
1655 else return surface->allVertices();
1656 return result;
1657 }
IdxDigitalSurface::Vertex IdxSurfel
Definition Shortcuts.h:169
std::vector< IdxSurfel > IdxSurfelRange
Definition Shortcuts.h:178
BreadthFirstVisitor< MyDigitalSurface > Visitor

â—† getIdxSurfelRange() [2/2]

template<typename TKSpace>
IdxSurfelRange DGtal::Shortcuts< TKSpace >::getIdxSurfelRange ( CountedPtr< IdxDigitalSurface > surface,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Given an indexed digital surface, returns a vector of surfels in some specified order.

Parameters
[in]surfacea smart pointer on a digital surface.
[in]paramsthe parameters:
  • surfaceTraversal ["Default"]: "Default"|"DepthFirst"|"BreadthFirst": "Default" default surface traversal, "DepthFirst": depth-first surface traversal, "BreadthFirst": breadth-first surface traversal.
Returns
a range of indexed surfels as a vector.

Definition at line 1612 of file Shortcuts.h.

1615 {
1616 return getIdxSurfelRange( surface, (IdxSurfel) 0, params );
1617 }
static IdxSurfelRange getIdxSurfelRange(CountedPtr< IdxDigitalSurface > surface, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1613

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getIdxSurfelRange(), DGtal::Shortcuts< Z3i::KSpace >::makeDigitalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::outputPrimalIdxDigitalSurfaceAsObj().

â—† getKSpace() [1/6]

template<typename TKSpace>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( const Point & low,
const Point & up,
Parameters params = parametersKSpace() )
inlinestatic

Builds a Khalimsky space that encompasses the lower and upper digital points. Note that digital points are cells of the Khalimsky space with maximal dimensions. A closed Khalimsky space adds lower dimensional cells all around its boundary to define a closed complex.

Parameters
[in]lowthe lowest point in the space
[in]upthe highest point in the space
[in]paramsthe parameters:
  • closed [1]: specifies if the Khalimsky space is closed (!=0) or not (==0).
Returns
the Khalimsky space.

Definition at line 333 of file Shortcuts.h.

335 {
336 int closed = params[ "closed" ].as<int>();
337 KSpace K;
338 if ( ! K.init( low, up, closed ) )
339 trace.error() << "[Shortcuts::getKSpace]"
340 << " Error building Khalimsky space K=" << K << std::endl;
341 return K;
342 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makePolygonalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::makeTriangulatedSurface().

â—† getKSpace() [2/6]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
the Khalimsky space associated to the given surface.

Definition at line 397 of file Shortcuts.h.

399 {
400 return surface->container().space();
401 }

â—† getKSpace() [3/6]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on any indexed digital surface.
Returns
the Khalimsky space associated to the given surface.

Definition at line 408 of file Shortcuts.h.

410 {
411 return surface->container().space();
412 }

â—† getKSpace() [4/6]

template<typename TKSpace>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( CountedPtr< BinaryImage > bimage,
Parameters params = parametersKSpace() )
inlinestatic

Builds a Khalimsky space that encompasses the domain of the given image. Note that digital points are cells of the Khalimsky space with maximal dimensions. A closed Khalimsky space adds lower dimensional cells all around its boundary to define a closed complex.

Parameters
[in]bimageany binary image
[in]paramsthe parameters:
  • closed [1]: specifies if the Khalimsky space is closed (!=0) or not (==0).
Returns
the Khalimsky space.

Definition at line 355 of file Shortcuts.h.

357 {
358 int closed = params[ "closed" ].as<int>();
359 KSpace K;
360 if ( ! K.init( bimage->domain().lowerBound(),
361 bimage->domain().upperBound(),
362 closed ) )
363 trace.error() << "[Shortcuts::getKSpace]"
364 << " Error building Khalimsky space K=" << K << std::endl;
365 return K;
366 }

â—† getKSpace() [5/6]

template<typename TKSpace>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( CountedPtr< GrayScaleImage > gimage,
Parameters params = parametersKSpace() )
inlinestatic

Builds a Khalimsky space that encompasses the domain of the given image. Note that digital points are cells of the Khalimsky space with maximal dimensions. A closed Khalimsky space adds lower dimensional cells all around its boundary to define a closed complex.

Parameters
[in]gimageany gray-scale image
[in]paramsthe parameters:
  • closed [1]: specifies if the Khalimsky space is closed (!=0) or not (==0).
Returns
the Khalimsky space.

Definition at line 379 of file Shortcuts.h.

381 {
382 int closed = params[ "closed" ].as<int>();
383 KSpace K;
384 if ( ! K.init( gimage->domain().lowerBound(),
385 gimage->domain().upperBound(),
386 closed ) )
387 trace.error() << "[Shortcuts::getKSpace]"
388 << " Error building Khalimsky space K=" << K << std::endl;
389 return K;
390 }

â—† getKSpace() [6/6]

template<typename TKSpace>
KSpace DGtal::Shortcuts< TKSpace >::getKSpace ( Parameters params = parametersKSpace() | parametersDigitizedImplicitShape3D())
inlinestatic

Builds a Khalimsky space that encompasses the bounding box specified by a digitization in params. It is useful when digitizing an implicit shape.

Parameters
[in]paramsthe parameters:
  • minAABB [-10.0]: the min value of the AABB bounding box (domain)
  • maxAABB [ 10.0]: the max value of the AABB bounding box (domain)
  • gridstep [ 1.0]: the gridstep that defines the digitization (often called h).
  • offset [ 5.0]: the digital dilation of the digital space, useful when you process shapes and that you add noise.
  • closed [1] : specifies if the Khalimsky space is closed (!=0) or not (==0).
Returns
the Khalimsky space.
See also
makeDigitizedImplicitShape3D

Definition at line 487 of file Shortcuts.h.

489 {
490 Scalar min_x = params[ "minAABB" ].as<Scalar>();
491 Scalar max_x = params[ "maxAABB" ].as<Scalar>();
492 Scalar h = params[ "gridstep" ].as<Scalar>();
493 Scalar offset = params[ "offset" ].as<Scalar>();
494 bool closed = params[ "closed" ].as<int>();
495 RealPoint p1( min_x - offset * h, min_x - offset * h, min_x - offset * h );
496 RealPoint p2( max_x + offset * h, max_x + offset * h, max_x + offset * h );
498 dshape->init( p1, p2, h );
499 Domain domain = dshape->getDomain();
500 KSpace K;
501 if ( ! K.init( domain.lowerBound(), domain.upperBound(), closed ) )
502 trace.error() << "[Shortcuts::getKSpace]"
503 << " Error building Khalimsky space K=" << K << std::endl
504 << "Note: if you use decimal values, check your locale for decimal point '.' or ','."
505 << std::endl;
506 return K;
507 }
Space::RealPoint RealPoint
Point with floating-point coordinates.
Definition Shortcuts.h:124
RealVector::Component Scalar
Floating-point numbers.
Definition Shortcuts.h:126
GaussDigitizer< Space, ImplicitShape3D > DigitizedImplicitShape3D
defines the digitization of an implicit shape.
Definition Shortcuts.h:140
HyperRectDomain< Space > Domain
An (hyper-)rectangular domain.
Definition Shortcuts.h:128

â—† getMatchedRange()

template<typename TKSpace>
template<typename TValue>
std::vector< TValue > DGtal::Shortcuts< TKSpace >::getMatchedRange ( const std::vector< TValue > & range,
const IdxRange & match )
inlinestatic

Given a perfect or approximate match, returns the corresponding reordered/rematched range.

Parameters
[in]rangeany range.
[in]matcha function V: Idx -> Idx such that result[ i / ] = range[ match[ i ] ].
@return the the corresponding reordered/rematched \a range. @see getRangeMatch

Definition at line 2736 of file Shortcuts.h.

2737 {
2739 for ( Idx i = 0; i < result.size(); i++ )
2740 result[ i ] = range[ match[ i ] ];
2741 return result;
2742 }

â—† getPointelRange() [1/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
PointelRange DGtal::Shortcuts< TKSpace >::getPointelRange ( Cell2Index & c2i,
CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface )
inlinestatic

Given any digital surface, returns the vector of its pointels.

Note
The order of pointels is given by the default traversal of the surfels of the surface, where the 4 pointels of each surfel are visited in order.
Since
1.1 The pointel ordering is now the same as the one given by makePrimalPolygonalSurface (for 3D only of course).
Note
If you wish to consider the primal digital surface, and visits pointels as vertices of this graph in breadth-first/depth-first order, the best is to build first a PolygonalSurface and then use specialized visitors.
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[out]c2ithe map Cell -> Vertex index in the pointel range.
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
a range of pointels as a vector.

Definition at line 1469 of file Shortcuts.h.

1472 {
1474 result.reserve( surface->size() );
1475 const KSpace& K = refKSpace( surface );
1476 Idx n = 0;
1477 for ( auto&& surfel : *surface )
1478 {
1480 for ( auto&& primal_vtx : primal_vtcs )
1481 {
1482 if ( ! c2i.count( primal_vtx ) )
1483 {
1484 result.push_back( primal_vtx );
1485 c2i[ primal_vtx ] = n++;
1486 }
1487 }
1488 }
1489 return result;
1490 }
CellRange PointelRange
Definition Shortcuts.h:176
static PointelRange getPointelRange(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
Definition Shortcuts.h:1470

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getPointelRange(), DGtal::Shortcuts< Z3i::KSpace >::getPointelRange(), DGtal::Shortcuts< Z3i::KSpace >::outputSurfelsAsObj(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), and DGtal::Shortcuts< Z3i::KSpace >::saveOFF().

â—† getPointelRange() [2/3]

template<typename TKSpace>
PointelRange DGtal::Shortcuts< TKSpace >::getPointelRange ( const KSpace & K,
const SCell & surfel )
inlinestatic

Given any surfel, returns its 4 pointels in ccw order.

See also
getPrimalVertices
Parameters
[in]Kthe Khalimsky space
[in]surfelany surfel that lives in the Khalimsky space
Returns
a range of pointels as a vector.

Definition at line 1526 of file Shortcuts.h.

1528 {
1529 return KSpace::dimension == 3
1530 ? getPrimalVertices( K, surfel, true )
1532 }
static CellRange getPrimalVertices(const KSpace &K, const SCell &s)
Definition Shortcuts.h:3263

â—† getPointelRange() [3/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
PointelRange DGtal::Shortcuts< TKSpace >::getPointelRange ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic

Given any digital surface, returns the vector of its pointels.

Note
The order of pointels is given by the default traversal of the surfels of the surface, where the 4 pointels of each surfel are visited in order.
If you wish to consider the primal digital surface, and visits pointels as vertices of this graph in breadth-first/depth-first order, the best is to build first a PolygonalSurface and then use specialized visitors.
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
a range of pointels as a vector.

Definition at line 1510 of file Shortcuts.h.

1512 {
1514 return getPointelRange( c2i, surface );
1515 }

â—† getPolynomialList()

template<typename TKSpace>
std::map< std::string, std::string > DGtal::Shortcuts< TKSpace >::getPolynomialList ( )
inlinestatic

Returns a map associating a name and a polynomial, e.g. "sphere1", "x^2+y^2+z^2-1".

{ "sphere1", "x^2+y^2+z^2-1" }, { "sphere9", "x^2+y^2+z^2-81" }, { "ellipsoid", "3*x^2+2*y^2+z^2-90" }, { "cylinder", "x^2+2*z^2-90" }, { "torus", "(x^2+y^2+z^2+6*6-2*2)^2-4*6*6*(x^2+y^2)" }, { "rcube", "x^4+y^4+z^4-6561" }, { "goursat", "-1*(8-0.03*x^4-0.03*y^4-0.03*z^4+2*x^2+2*y^2+2*z^2)" }, { "distel", "10000-(x^2+y^2+z^2+1000*(x^2+y^2)*(x^2+z^2)*(y^2+z^2))"}, { "leopold", "(x^2*y^2*z^2+4*x^2+4*y^2+3*z^2)-100" }, { "diabolo", "x^2-(y^2+z^2)^2" }, { "heart", "-1*(x^2+2.25*y^2+z^2-1)^3+x^2*z^3+0.1125*y^2*z^3" }, { "crixxi", "-0.9*(y^2+z^2-1)^2-(x^2+y^2-1)^3" }

Returns
the map associating a polynomial to a name.

Definition at line 237 of file Shortcuts.h.

238 {
240 Ps = { { "sphere1", "x^2+y^2+z^2-1" },
241 { "sphere9", "x^2+y^2+z^2-81" },
242 { "ellipsoid", "3*x^2+2*y^2+z^2-90" },
243 { "cylinder", "x^2+2*z^2-90" },
244 { "torus", "(x^2+y^2+z^2+6*6-2*2)^2-4*6*6*(x^2+y^2)" },
245 { "rcube", "x^4+y^4+z^4-6561" },
246 { "goursat", "-1*(8-0.03*x^4-0.03*y^4-0.03*z^4+2*x^2+2*y^2+2*z^2)" },
247 { "goursat-hole", "x^4+y^4+z^4-2*4*(x^2+y^2+z^2)+2*4*4-2" },
248 { "distel", "10000-(x^2+y^2+z^2+1000*(x^2+y^2)*(x^2+z^2)*(y^2+z^2))"},
249 { "leopold", "(x^2*y^2*z^2+4*x^2+4*y^2+3*z^2)-100" },
250 { "diabolo", "x^2-(y^2+z^2)^2" },
251 { "heart", "-1*(x^2+2.25*y^2+z^2-1)^3+x^2*z^3+0.1125*y^2*z^3" },
252 { "crixxi", "-0.9*(y^2+z^2-1)^2-(x^2+y^2-1)^3" } };
254 for ( auto p : Ps )
255 L[ p.first ] = p.second;
256 return L;
257 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeImplicitShape3D().

â—† getPrimalCells()

template<typename TKSpace>
CellRange DGtal::Shortcuts< TKSpace >::getPrimalCells ( const KSpace & K,
const SCell & s,
const Dimension k )
inlinestatic

Given a space K and an oriented cell s, returns its vertices.

Parameters
Kany cellular grid space.
sany signed cell.
kany dimension between 0 and K.sdim(s).
Returns
the vector of the faces of dimension k of s, as unsigned cells.

Definition at line 3247 of file Shortcuts.h.

3248 {
3249 auto faces = K.uFaces( K.unsigns( s ) );
3251 for ( auto&& f : faces )
3252 {
3253 if ( K.uDim( f ) == k ) primal_cells.push_back( f );
3254 }
3255 return primal_cells;
3256 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getCellRange(), and DGtal::Shortcuts< Z3i::KSpace >::getPrimalVertices().

â—† getPrimalVertices() [1/2]

template<typename TKSpace>
CellRange DGtal::Shortcuts< TKSpace >::getPrimalVertices ( const KSpace & K,
const SCell & s )
inlinestatic

Given a space K and an oriented cell s, returns its vertices.

Parameters
Kany cellular grid space.
sany signed cell.
Returns
the vector of the vertices of s, as unsigned cells of dimension 0.

Definition at line 3263 of file Shortcuts.h.

3264 {
3265 return getPrimalCells( K, s, 0 );
3266 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getPointelRange(), and DGtal::Shortcuts< Z3i::KSpace >::getPrimalVertices().

â—† getPrimalVertices() [2/2]

template<typename TKSpace>
CellRange DGtal::Shortcuts< TKSpace >::getPrimalVertices ( const KSpace & K,
const Surfel & s,
bool ccw )
inlinestatic

Given a space K and a surfel s, returns its vertices in ccw or cw order.

Parameters
Kany cellular grid space of dimension 3.
sany surfel, a signed cell of dimension 2.
ccwwhen 'true', the order corresponds to a ccw orientation seen from the exterior normal to the surfel, otherwise it is a cw order.
Returns
the vector of the vertices of s, as unsigned cells of dimension 0.
Note
useful when exporting faces to OBJ format.

Definition at line 3275 of file Shortcuts.h.

3276 {
3279 std::swap( vtcs[ 2 ], vtcs[ 3 ] );
3280 auto orth_dir = K.sOrthDir( s );
3281 auto direct = K.sDirect( s, orth_dir ) ? ccw : ! ccw;
3282 Vector s0s1 = K.uCoords( vtcs[ 1 ] ) - K.uCoords( vtcs[ 0 ] );
3283 Vector s0s2 = K.uCoords( vtcs[ 2 ] ) - K.uCoords( vtcs[ 0 ] );
3284 Vector t = s0s1.crossProduct( s0s2 );
3285 if ( ( ( t[ orth_dir ] > 0.0 ) && direct )
3286 || ( ( t[ orth_dir ] < 0.0 ) && ! direct ) )
3287 std::reverse( vtcs.begin(), vtcs.end() );
3288 return vtcs;
3289 }
Space::Vector Vector
Vector with integer coordinates.
Definition Shortcuts.h:120

â—† getRangeMatch()

template<typename TKSpace>
template<typename TValue>
IdxRange DGtal::Shortcuts< TKSpace >::getRangeMatch ( const std::vector< TValue > & s1,
const std::vector< TValue > & s2,
bool perfect = false )
inlinestatic

Given two ranges with same elements but not necessarily in the same order, returns a vector V: index -> index such that s1[ / i ] == s2[ V[ i ] ].

@tparam TValue a model of boost::Assignable, boost::CopyConstructible, boost::LessThanComparable @param[in] s1 a range of values @param[in] s2 another range of values which contains the same values as \a s1 but in any order. @param[in] perfect if 'true' ask for a perfect match, otherwise extracts correspondences. @return the vector V: index -> index such that `s1[ i ] == s2[

/ V[ i ] ]`. If perfect is true, then an empty range is returned in case of mismatch.

Note
if perfect==false and s1[ i ] is not in s2, then V[ i ] = s2.size().

Definition at line 2701 of file Shortcuts.h.

2703 {
2704 if ( perfect && ( s1.size() != s2.size() ) ) return IdxRange();
2706 Idx idx = 0;
2707 for ( auto val : s2 ) M[ val ] = idx++;
2708 IdxRange V( s1.size() );
2709 idx = 0;
2710 for ( auto val : s1 )
2711 {
2712 auto it = M.find( val );
2713 if ( it != M.end() ) V[ idx++ ] = it->second;
2714 else
2715 {
2716 if ( perfect ) return IdxRange();
2717 V[ idx++ ] = s2.size();
2718 }
2719 }
2720 return V;
2721 }
std::vector< IdxVertex > IdxRange
Definition Shortcuts.h:183

â—† getSCellEmbedder() [1/3]

template<typename TKSpace>
CanonicSCellEmbedder< KSpace > DGtal::Shortcuts< TKSpace >::getSCellEmbedder ( const KSpace & K)
inlinestatic
Parameters
[in]Kany Khalimsky space.
Returns
the canonic signed cell embedder associated to the given Khalimsky space.

Definition at line 447 of file Shortcuts.h.

448 {
450 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getSCellEmbedder(), and DGtal::Shortcuts< Z3i::KSpace >::getSCellEmbedder().

â—† getSCellEmbedder() [2/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CanonicSCellEmbedder< KSpace > DGtal::Shortcuts< TKSpace >::getSCellEmbedder ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
the canonic signed cell embedder associated to the given digital surface.

Definition at line 1022 of file Shortcuts.h.

1024 {
1025 return getSCellEmbedder( refKSpace( surface ) );
1026 }
static CanonicSCellEmbedder< KSpace > getSCellEmbedder(const KSpace &K)
Definition Shortcuts.h:447

â—† getSCellEmbedder() [3/3]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CanonicSCellEmbedder< KSpace > DGtal::Shortcuts< TKSpace >::getSCellEmbedder ( CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on any indexed digital surface.
Returns
the canonic signed cell embedder associated to the given indexed digital surface.

Definition at line 1044 of file Shortcuts.h.

1046 {
1047 return getSCellEmbedder( refKSpace( surface ) );
1048 }

â—† getSurfelRange() [1/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
SurfelRange DGtal::Shortcuts< TKSpace >::getSurfelRange ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Given any digital surface, returns a vector of surfels in some specified order.

Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
[in]paramsthe parameters:
  • surfaceTraversal ["Default"]: "Default"|"DepthFirst"|"BreadthFirst": "Default" default surface traversal, "DepthFirst": depth-first surface traversal, "BreadthFirst": breadth-first surface traversal.
Returns
a range of surfels as a vector.

Definition at line 1547 of file Shortcuts.h.

1550 {
1551 return getSurfelRange( surface, *( surface->begin() ), params );
1552 }
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1548

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getSurfelRange(), and DGtal::Shortcuts< Z3i::KSpace >::outputPrimalDigitalSurfaceAsObj().

â—† getSurfelRange() [2/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
SurfelRange DGtal::Shortcuts< TKSpace >::getSurfelRange ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Surfel & start_surfel,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Given a light digital surface, returns a vector of surfels in some specified order.

Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
[in]start_surfelthe surfel where the traversal starts in case of depth-first/breadth-first traversal.
[in]paramsthe parameters:
  • surfaceTraversal ["Default"]: "Default"|"DepthFirst"|"BreadthFirst": "Default" default surface traversal, "DepthFirst": depth-first surface traversal, "BreadthFirst": breadth-first surface traversal.
Returns
a range of surfels as a vector.

Definition at line 1570 of file Shortcuts.h.

1574 {
1577 std::string traversal = params[ "surfaceTraversal" ].as<std::string>();
1578 if ( traversal == "DepthFirst" )
1579 {
1583 std::for_each( range.begin(), range.end(),
1584 [&result] ( Surfel s ) { result.push_back( s ); } );
1585 }
1586 else if ( traversal == "BreadthFirst" )
1587 {
1591 std::for_each( range.begin(), range.end(),
1592 [&result] ( Surfel s ) { result.push_back( s ); } );
1593 }
1594 else
1595 {
1596 std::for_each( surface->begin(), surface->end(),
1597 [&result] ( Surfel s ) { result.push_back( s ); } );
1598 }
1599 return result;
1600 }
LightDigitalSurface::Surfel Surfel
Definition Shortcuts.h:162
SCellRange SurfelRange
Definition Shortcuts.h:177

â—† getZeroTickedColorMap()

template<typename TKSpace>
ZeroTickedColorMap DGtal::Shortcuts< TKSpace >::getZeroTickedColorMap ( Scalar min,
Scalar max,
const Parameters & params = parametersUtilities() )
inlinestatic
Parameters
[in]minthe minimum considered value for the colormap.
[in]maxthe maximum considered value for the colormap.
[in]paramsthe parameters:
  • colormap [ "Custom" ]: "Cool"|"Copper"|"Hot"|"Jet"|"Spring"|"Summer"|"Autumn"|"Winter"|"Error"|"Custom" specifies standard colormaps (if invalid, falls back to "Custom").
  • zero-tic [ 0.0 ]: if positive defines a black zone ]-zt,zt[ in the colormap.
Returns
a colormap according to the specified parameters adapted to make darker tics for a background "Tics" colormap.

Definition at line 2789 of file Shortcuts.h.

2792 {
2793 auto cmap = getColorMap( min, max, params );
2794 auto ztic = params[ "zero-tic" ].as<double>();
2796 if ( ztic <= 0.0 ) return ztic_cmap;
2797 if ( min <= 0.0 && 0.0 <= max )
2798 ztic_cmap.addTick( 0.0, ztic );
2799 ztic_cmap.finalize();
2800 return ztic_cmap;
2801 }
static const Color Black
Definition Color.h:422
static ColorMap getColorMap(Scalar min, Scalar max, const Parameters &params=parametersUtilities())
Definition Shortcuts.h:2751
TickedColorMap< Scalar, ColorMap > ZeroTickedColorMap
Definition Shortcuts.h:195

â—† isValid()

template<typename TKSpace>
bool DGtal::Shortcuts< TKSpace >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Definition at line 3347 of file Shortcuts.h.

3348 {
3349 return true;
3350 }

â—† makeBinaryImage() [1/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( CountedPtr< BinaryImage > bimage,
Parameters params = parametersBinaryImage() )
inlinestatic

Adds Kanungo noise to a binary image and returns the resulting new image.

Parameters
[in]bimagea smart pointer on a binary image.
[in]paramsthe parameters:
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
Returns
a smart pointer on the noisified binary image.

Definition at line 629 of file Shortcuts.h.

631 {
632 const Scalar noise = params[ "noise" ].as<Scalar>();
633 if ( noise <= 0.0 ) return bimage;
635 const Domain shapeDomain = bimage->domain();
638 std::transform( shapeDomain.begin(), shapeDomain.end(),
639 img->begin(),
640 [&noisy_dshape] ( const Point& p ) { return noisy_dshape(p); } );
641 return img;
642 }
ImageContainerBySTLVector< Domain, bool > BinaryImage
defines a black and white image with (hyper-)rectangular domain.
Definition Shortcuts.h:142
Space::Point Point
Point with integer coordinates.
Definition Shortcuts.h:118

â—† makeBinaryImage() [2/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( CountedPtr< DigitizedImplicitShape3D > shape_digitization,
Domain shapeDomain,
Parameters params = parametersBinaryImage() )
inlinestatic

Vectorizes an implicitly defined digital shape into a binary image, in the specified (hyper-)rectangular domain, and possibly add Kanungo noise to the result depending on parameters given in params.

Parameters
[in]shape_digitizationa smart pointer on an implicit digital shape.
[in]shapeDomainany domain.
[in]paramsthe parameters:
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
Returns
a smart pointer on a binary image that samples the digital shape.

Definition at line 597 of file Shortcuts.h.

600 {
601 const Scalar noise = params[ "noise" ].as<Scalar>();
603 if ( noise <= 0.0 )
604 {
605 std::transform( shapeDomain.begin(), shapeDomain.end(),
606 img->begin(),
608 ( const Point& p ) { return (*shape_digitization)(p); } );
609 }
610 else
611 {
614 std::transform( shapeDomain.begin(), shapeDomain.end(),
615 img->begin(),
616 [&noisy_dshape] ( const Point& p ) { return noisy_dshape(p); } );
617 }
618 return img;
619 }

â—† makeBinaryImage() [3/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( CountedPtr< DigitizedImplicitShape3D > shape_digitization,
Parameters params = parametersBinaryImage() )
inlinestatic

Vectorizes an implicitly defined digital shape into a binary image, and possibly add Kanungo noise to the result depending on parameters given in params.

Parameters
[in]shape_digitizationa smart pointer on an implicit digital shape.
[in]paramsthe parameters:
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
Returns
a smart pointer on a binary image that samples the digital shape.

Definition at line 577 of file Shortcuts.h.

579 {
581 shape_digitization->getDomain(),
582 params );
583 }
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
Definition Shortcuts.h:562

â—† makeBinaryImage() [4/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( CountedPtr< GrayScaleImage > gray_scale_image,
Parameters params = parametersBinaryImage() )
inlinestatic

Binarizes an arbitrary gray scale image file and returns the binary image corresponding to the threshold/noise parameters.

Parameters
[in]gray_scale_imagethe input gray scale image.
[in]paramsthe parameters:
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
  • thresholdMin [ 0]: specifies the threshold min (excluded) to define binary shape
  • thresholdMax [255]: specifies the threshold max (included) to define binary shape
Returns
a smart pointer on a binary image that represents the (thresholded/noisified) gray scale image.

Definition at line 685 of file Shortcuts.h.

688 {
689 int thresholdMin = params["thresholdMin"].as<int>();
690 int thresholdMax = params["thresholdMax"].as<int>();
691 Domain domain = gray_scale_image->domain();
695 std::transform( domain.begin(), domain.end(),
696 img->begin(),
697 [tImage] ( const Point& p ) { return tImage(p); } );
698 return makeBinaryImage( img, params );
699 }

â—† makeBinaryImage() [5/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( Domain shapeDomain)
inlinestatic

Makes an empty binary image within a given domain.

Parameters
[in]shapeDomainany domain.
Returns
a smart pointer on a binary image that fits the given domain.

Definition at line 562 of file Shortcuts.h.

563 {
565 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeBinaryImage(), DGtal::Shortcuts< Z3i::KSpace >::makeBinaryImage(), DGtal::Shortcuts< Z3i::KSpace >::makeBinaryImage(), DGtal::Shortcuts< Z3i::KSpace >::makePolygonalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::makeTriangulatedSurface().

â—† makeBinaryImage() [6/6]

template<typename TKSpace>
CountedPtr< BinaryImage > DGtal::Shortcuts< TKSpace >::makeBinaryImage ( std::string input,
Parameters params = parametersBinaryImage() )
inlinestatic

Loads an arbitrary image file (e.g. vol file in 3D) and returns the binary image corresponding to the threshold/noise parameters.

Parameters
[in]inputthe input filename.
[in]paramsthe parameters:
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
  • thresholdMin [ 0]: specifies the threshold min (excluded) to define binary shape
  • thresholdMax [255]: specifies the threshold max (included) to define binary shape
Returns
a smart pointer on a binary image that represents the (thresholded/noisified) image file.

Definition at line 656 of file Shortcuts.h.

659 {
660 int thresholdMin = params["thresholdMin"].as<int>();
661 int thresholdMax = params["thresholdMax"].as<int>();
663 Domain domain = image.domain();
667 std::transform( domain.begin(), domain.end(),
668 img->begin(),
669 [tImage] ( const Point& p ) { return tImage(p); } );
670 return makeBinaryImage( img, params );
671 }
ImageContainerBySTLVector< Domain, GrayScale > GrayScaleImage
defines a grey-level image with (hyper-)rectangular domain.
Definition Shortcuts.h:144
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())

â—† makeDigitalSurface() [1/2]

template<typename TKSpace>
CountedPtr< DigitalSurface > DGtal::Shortcuts< TKSpace >::makeDigitalSurface ( CountedPtr< IdxDigitalSurface > idx_surface,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds a explicit digital surface from an indexed digital surface.

Note
if the given surfel adjacency is not the same as the one chosen for the input indexed digital surface, the number of connected components may change in the process.
Parameters
[in]idx_surfaceany indexed digital surface.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
Returns
a smart pointer on a explicit digital surface.

Definition at line 1240 of file Shortcuts.h.

1243 {
1244 bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1245 const KSpace& K = refKSpace( idx_surface );
1247 auto all_idx_surfels
1248 = getIdxSurfelRange( idx_surface, Parameters( "surfaceTraversal", "Default" ) );
1249 auto idx2surfel = idx_surface->surfels();
1251 for ( auto idx : all_idx_surfels ) all_surfels.insert( idx2surfel[ idx ] );
1255 ( new DigitalSurface( surfContainer ) ); // acquired
1256 }
SetOfSurfels< KSpace, SurfelSet > ExplicitSurfaceContainer
defines a heavy container that represents any digital surface.
Definition Shortcuts.h:157
KSpace::SurfelSet SurfelSet
defines a set of surfels
Definition Shortcuts.h:150
::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface
defines an arbitrary digital surface over a binary image.
Definition Shortcuts.h:159

â—† makeDigitalSurface() [2/2]

template<typename TKSpace>
template<typename TPointPredicate>
CountedPtr< DigitalSurface > DGtal::Shortcuts< TKSpace >::makeDigitalSurface ( CountedPtr< TPointPredicate > bimage,
const KSpace & K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Creates a explicit digital surface representing the boundaries in the binary image bimage, or any one of its big components according to parameters.

Template Parameters
TPointPredicateany type representing a point predicate (e.g. a BinaryImage or a DigitizedImplicitShape3D).
Parameters
[in]bimageany point predicate: Point -> boolean that represents the characteristic function of a digital shape
[in]Kthe Khalimsky space whose domain encompasses the digital shape.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
Returns
a smart pointer on the explicit digital surface representing the boundaries in the binary image.

Definition at line 1209 of file Shortcuts.h.

1213 {
1215 bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1217 // Extracts all boundary surfels
1219 K.lowerBound(), K.upperBound() );
1223 ( new DigitalSurface( surfContainer ) ); // acquired
1224 }
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makePolygonalSurface(), DGtal::Shortcuts< Z3i::KSpace >::makePrimalPolygonalSurface(), DGtal::Shortcuts< Z3i::KSpace >::makePrimalSurfaceMesh(), and DGtal::Shortcuts< Z3i::KSpace >::makeTriangulatedSurface().

â—† makeDigitizedImplicitShape3D()

template<typename TKSpace>
CountedPtr< DigitizedImplicitShape3D > DGtal::Shortcuts< TKSpace >::makeDigitizedImplicitShape3D ( CountedPtr< ImplicitShape3D > shape,
Parameters params = parametersDigitizedImplicitShape3D() )
inlinestatic

Makes the Gauss digitization of the given implicit shape according to parameters. Use getKSpace to build the associated digital space.

Parameters
[in]shapea smart pointer on the implicit shape.
[in]paramsthe parameters:
  • minAABB [-10.0]: the min value of the AABB bounding box (domain)
  • maxAABB [ 10.0]: the max value of the AABB bounding box (domain)
  • gridstep [ 1.0]: the gridstep that defines the digitization (often called h).
  • offset [ 5.0]: the digital dilation of the digital space, useful when you process shapes and that you add noise.
Returns
a smart pointer on the created implicit digital shape.
See also
getKSpaceDigitizedImplicitShape3D

Definition at line 523 of file Shortcuts.h.

526 {
527 Scalar min_x = params[ "minAABB" ].as<Scalar>();
528 Scalar max_x = params[ "maxAABB" ].as<Scalar>();
529 Scalar h = params[ "gridstep" ].as<Scalar>();
530 Scalar offset = params[ "offset" ].as<Scalar>();
531 RealPoint p1( min_x - offset * h, min_x - offset * h, min_x - offset * h );
532 RealPoint p2( max_x + offset * h, max_x + offset * h, max_x + offset * h );
534 dshape->attach( shape );
535 dshape->init( p1, p2, h );
536 return dshape;
537 }

â—† makeDoubleImage() [1/3]

template<typename TKSpace>
CountedPtr< DoubleImage > DGtal::Shortcuts< TKSpace >::makeDoubleImage ( CountedPtr< ImplicitShape3D > shape,
Parameters params = parametersDigitizedImplicitShape3D() )
inlinestatic

Makes a double image from the given implicit shape according to parameters. Use getKSpace to build the associated digital space.

Parameters
[in]shapea smart pointer on the implicit shape.
[in]paramsthe parameters:
  • minAABB [-10.0]: the min value of the AABB bounding box (domain)
  • maxAABB [ 10.0]: the max value of the AABB bounding box (domain)
  • gridstep [ 1.0]: the gridstep that defines the digitization (often called h).
  • offset [ 5.0]: the digital dilation of the digital space, useful when you process shapes and that you add noise.
Returns
a smart pointer on the created image.

Definition at line 964 of file Shortcuts.h.

967 {
968 Scalar min_x = params[ "minAABB" ].as<Scalar>();
969 Scalar max_x = params[ "maxAABB" ].as<Scalar>();
970 Scalar h = params[ "gridstep" ].as<Scalar>();
971 Scalar offset = params[ "offset" ].as<Scalar>();
972 RealPoint p1( min_x - offset * h, min_x - offset * h, min_x - offset * h );
973 RealPoint p2( max_x + offset * h, max_x + offset * h, max_x + offset * h );
975 dshape->attach( shape );
976 dshape->init( p1, p2, h );
977 Domain domain = dshape->getDomain();
978 auto fimage = makeDoubleImage( domain );
979 auto it = fimage->begin();
980 for ( auto p : domain )
981 {
982 double val = (double) (*shape)( p );
983 *it++ = val;
984 }
985 return fimage;
986 }
static CountedPtr< DoubleImage > makeDoubleImage(Domain aDomain)
Definition Shortcuts.h:931

â—† makeDoubleImage() [2/3]

template<typename TKSpace>
CountedPtr< DoubleImage > DGtal::Shortcuts< TKSpace >::makeDoubleImage ( Domain aDomain)
inlinestatic

Makes an empty double image within a given domain (values are unsigned char).

Parameters
[in]aDomainany domain.
Returns
a smart pointer on a double image that fits the given domain.

Definition at line 931 of file Shortcuts.h.

932 {
934 }
ImageContainerBySTLVector< Domain, double > DoubleImage
defines a double image with (hyper-)rectangular domain.
Definition Shortcuts.h:148

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeDoubleImage().

â—† makeDoubleImage() [3/3]

template<typename TKSpace>
CountedPtr< DoubleImage > DGtal::Shortcuts< TKSpace >::makeDoubleImage ( std::string input)
inlinestatic

Loads an arbitrary image file (e.g. vol file in 3D) and returns the corresponding double image.

Parameters
[in]inputthe input filename.
Returns
a smart pointer on the loaded double image.

Definition at line 943 of file Shortcuts.h.

â—† makeDualPolygonalSurface() [1/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makeDualPolygonalSurface ( CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the dual polygonal surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface.

Definition at line 2289 of file Shortcuts.h.

2290 {
2293 }
std::map< Surfel, IdxSurfel > Surfel2Index
Definition Shortcuts.h:189
static CountedPtr< PolygonalSurface > makeDualPolygonalSurface(Surfel2Index &s2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition Shortcuts.h:2269

â—† makeDualPolygonalSurface() [2/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makeDualPolygonalSurface ( CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the dual polygonal surface associated to the given indexed digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany indexed digital surface (e.g. IdxDigitalSurface)
Returns
a smart pointer on the built polygonal surface.

Definition at line 2303 of file Shortcuts.h.

2305 {
2308 ( new PolygonalSurface( aSurface->heds(),
2309 aSurface->positions().storage() ) );
2310 return pPolySurf;
2311 }
::DGtal::PolygonalSurface< RealPoint > PolygonalSurface
Definition Shortcuts.h:187

â—† makeDualPolygonalSurface() [3/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makeDualPolygonalSurface ( Surfel2Index & s2i,
CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface )
inlinestatic

Builds the dual polygonal surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[out]s2ithe map Surfel -> Vertex index in the polygonal surface.
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface.

Definition at line 2269 of file Shortcuts.h.

2271 {
2275 ( new PolygonalSurface ); // acquired
2277 ( *aSurface, embedder, *pPolySurf, s2i );
2278 return pPolySurf;
2279 }
static void digitalSurface2DualPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, VertexMap &vertexmap)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeDualPolygonalSurface().

â—† makeFloatImage() [1/3]

template<typename TKSpace>
CountedPtr< FloatImage > DGtal::Shortcuts< TKSpace >::makeFloatImage ( CountedPtr< ImplicitShape3D > shape,
Parameters params = parametersDigitizedImplicitShape3D() )
inlinestatic

Makes a float image from the given implicit shape according to parameters. Use getKSpace to build the associated digital space.

Parameters
[in]shapea smart pointer on the implicit shape.
[in]paramsthe parameters:
  • minAABB [-10.0]: the min value of the AABB bounding box (domain)
  • maxAABB [ 10.0]: the max value of the AABB bounding box (domain)
  • gridstep [ 1.0]: the gridstep that defines the digitization (often called h).
  • offset [ 5.0]: the digital dilation of the digital space, useful when you process shapes and that you add noise.
Returns
a smart pointer on the created image.

Definition at line 898 of file Shortcuts.h.

901 {
902 Scalar min_x = params[ "minAABB" ].as<Scalar>();
903 Scalar max_x = params[ "maxAABB" ].as<Scalar>();
904 Scalar h = params[ "gridstep" ].as<Scalar>();
905 Scalar offset = params[ "offset" ].as<Scalar>();
906 RealPoint p1( min_x - offset * h, min_x - offset * h, min_x - offset * h );
907 RealPoint p2( max_x + offset * h, max_x + offset * h, max_x + offset * h );
909 dshape->attach( shape );
910 dshape->init( p1, p2, h );
911 Domain domain = dshape->getDomain();
912 auto fimage = makeFloatImage( domain );
913 auto it = fimage->begin();
914 for ( auto p : domain )
915 {
916 float val = (float) (*shape)( p );
917 *it++ = val;
918 }
919 return fimage;
920 }
static CountedPtr< FloatImage > makeFloatImage(Domain aDomain)
Definition Shortcuts.h:865

â—† makeFloatImage() [2/3]

template<typename TKSpace>
CountedPtr< FloatImage > DGtal::Shortcuts< TKSpace >::makeFloatImage ( Domain aDomain)
inlinestatic

Makes an empty float image within a given domain (values are unsigned char).

Parameters
[in]aDomainany domain.
Returns
a smart pointer on a float image that fits the given domain.

Definition at line 865 of file Shortcuts.h.

866 {
868 }
ImageContainerBySTLVector< Domain, float > FloatImage
defines a float image with (hyper-)rectangular domain.
Definition Shortcuts.h:146

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeFloatImage().

â—† makeFloatImage() [3/3]

template<typename TKSpace>
CountedPtr< FloatImage > DGtal::Shortcuts< TKSpace >::makeFloatImage ( std::string input)
inlinestatic

Loads an arbitrary image file (e.g. vol file in 3D) and returns the corresponding float image.

Parameters
[in]inputthe input filename.
Returns
a smart pointer on the loaded float image.

Definition at line 877 of file Shortcuts.h.

â—† makeGrayScaleImage() [1/5]

template<typename TKSpace>
CountedPtr< GrayScaleImage > DGtal::Shortcuts< TKSpace >::makeGrayScaleImage ( CountedPtr< BinaryImage > binary_image,
std::function< GrayScale(bool) > const & bool2grayscale = [] ( bool v ) { return v ? (unsigned char) 255 : (unsigned char) 0; } )
inlinestatic

Makes a gray-scale image from a binary image using the given transformation

Parameters
[in]binary_imagethe input binary image.
[in]bool2grayscalethe binarizing function.
Returns
a smart pointer on the resulting gray-scale image.

Definition at line 763 of file Shortcuts.h.

766 { return v ? (unsigned char) 255 : (unsigned char) 0; }
767 // JOL: (GrayScale) was not working with visual C++: error C2065
768 )
769 {
770 const Domain domain = binary_image->domain();
772 std::transform( binary_image->begin(), binary_image->end(),
773 gray_scale_image->begin(),
775 return gray_scale_image;
776 }

â—† makeGrayScaleImage() [2/5]

template<typename TKSpace>
CountedPtr< GrayScaleImage > DGtal::Shortcuts< TKSpace >::makeGrayScaleImage ( CountedPtr< DoubleImage > fimage,
Parameters params = parametersGrayScaleImage() )
inlinestatic

Makes a gray-scale image from the given double image. (i.e. quantify the given image)..

Parameters
[in]fimagea smart pointer on the double image.
[in]paramsthe parameters:
  • qShift [128.0]: the shift used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).
  • qSlope [ 1.0]: the slope used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).
Returns
a smart pointer on the created image

Definition at line 836 of file Shortcuts.h.

839 {
840 double qShift = params[ "qShift" ].as<double>();
841 double qSlope = params[ "qSlope" ].as<double>();
842 std::function< unsigned char( double ) > f
843 = [qShift,qSlope] (double v)
844 { return (unsigned char) std::min( 255.0, std::max( 0.0, qSlope * v + qShift ) ); };
845 Domain domain = fimage->domain();
847 auto it = gimage->begin();
848 for ( auto p : domain )
849 {
850 double val = (*fimage)( p );
851 *it++ = f( val );
852 }
853 return gimage;
854 }
static CountedPtr< GrayScaleImage > makeGrayScaleImage(Domain aDomain)
Definition Shortcuts.h:737

â—† makeGrayScaleImage() [3/5]

template<typename TKSpace>
CountedPtr< GrayScaleImage > DGtal::Shortcuts< TKSpace >::makeGrayScaleImage ( CountedPtr< FloatImage > fimage,
Parameters params = parametersGrayScaleImage() )
inlinestatic

Makes a gray-scale image from the given float image (i.e. quantify the given image)..

Parameters
[in]fimagea smart pointer on the float image.
[in]paramsthe parameters:
  • qShift [128.0]: the shift used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).
  • qSlope [ 1.0]: the slope used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).
Returns
a smart pointer on the created image

Definition at line 804 of file Shortcuts.h.

807 {
808 float qShift = params[ "qShift" ].as<float>();
809 float qSlope = params[ "qSlope" ].as<float>();
810 std::function< unsigned char( float ) > f
811 = [qShift,qSlope] (float v)
812 { return (unsigned char) std::min( 255.0f, std::max( 0.0f, qSlope * v + qShift ) ); };
813 Domain domain = fimage->domain();
815 auto it = gimage->begin();
816 for ( auto p : domain )
817 {
818 float val = (*fimage)( p );
819 *it++ = f( val );
820 }
821 return gimage;
822 }

â—† makeGrayScaleImage() [4/5]

template<typename TKSpace>
CountedPtr< GrayScaleImage > DGtal::Shortcuts< TKSpace >::makeGrayScaleImage ( Domain aDomain)
inlinestatic

Makes an empty gray scale image within a given domain (values are unsigned char).

Parameters
[in]aDomainany domain.
Returns
a smart pointer on a gray scale image that fits the given domain.

Definition at line 737 of file Shortcuts.h.

738 {
740 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeGrayScaleImage(), DGtal::Shortcuts< Z3i::KSpace >::makeGrayScaleImage(), and DGtal::Shortcuts< Z3i::KSpace >::saveBinaryImage().

â—† makeGrayScaleImage() [5/5]

template<typename TKSpace>
CountedPtr< GrayScaleImage > DGtal::Shortcuts< TKSpace >::makeGrayScaleImage ( std::string input)
inlinestatic

Loads an arbitrary binary image file (e.g. vol file in 3D) and returns the corresponding gray-scale image.

Parameters
[in]inputthe input filename.
Returns
a smart pointer on the loaded gray-scale image.

Definition at line 749 of file Shortcuts.h.

â—† makeIdxDigitalSurface() [1/4]

template<typename TKSpace>
CountedPtr< IdxDigitalSurface > DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface ( const std::vector< CountedPtr< LightDigitalSurface > > & surfaces,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds an indexed digital surface from a vector of light digital surfaces. Note that the surfel adjacency may be changed and a connected light digital surface could be disconnected in the process.

Note
the surfaces must live in the same digital spaces.
Parameters
[in]surfacesa vector of smart pointers on light digital surfaces.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
Returns
a smart pointer on the required indexed digital surface.

Definition at line 1364 of file Shortcuts.h.

1367 {
1368 if ( surfaces.empty() ) return CountedPtr<IdxDigitalSurface>( 0 );
1369 const KSpace& K = surfaces[ 0 ]->container().space();
1371 for ( std::size_t i = 0; i < surfaces.size(); ++i )
1372 {
1373 const KSpace& Ki = surfaces[ i ]->container().space();
1374 if ( ( Ki.lowerBound() != K.lowerBound() )
1375 || ( Ki.upperBound() != K.upperBound() ) )
1376 trace.warning() << "[Shortcuts::makeIdxDigitalSurface]"
1377 << " Incompatible digital spaces for surface " << i << std::endl;
1378 surfels.insert( surfaces[ i ]->begin(), surfaces[ i ]->end() );
1379 }
1381 }
static CountedPtr< IdxDigitalSurface > makeIdxDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1276

â—† makeIdxDigitalSurface() [2/4]

template<typename TKSpace>
template<typename TSurfelRange>
CountedPtr< IdxDigitalSurface > DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface ( const TSurfelRange & surfels,
ConstAlias< KSpace > K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds an indexed digital surface from a space K and an arbitrary range of surfels.

Parameters
[in]surfelsan arbitrary range of surfels.
[in]Kthe Khalimsky space whose domain encompasses the given surfels.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
Returns
a smart pointer on the indexed digital surface built over the surfels.

Definition at line 1308 of file Shortcuts.h.

1312 {
1313 bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1315 // Build indexed digital surface.
1319 ( new IdxDigitalSurface() );
1320 bool ok = ptrSurface->build( ptrSurfContainer );
1321 if ( !ok )
1322 trace.warning() << "[Shortcuts::makeIdxDigitalSurface]"
1323 << " Error building indexed digital surface." << std::endl;
1324 return ptrSurface;
1325 }
IndexedDigitalSurface< ExplicitSurfaceContainer > IdxDigitalSurface
defines a connected or not indexed digital surface.
Definition Shortcuts.h:161

â—† makeIdxDigitalSurface() [3/4]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
CountedPtr< IdxDigitalSurface > DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds an indexed digital surface from a light digital surface. Note that the surfel adjacency may be changed and a connected light digital surface could be disconnected in the process.

Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
Returns
a smart pointer on the required indexed digital surface.

Definition at line 1341 of file Shortcuts.h.

1344 {
1345 const KSpace& K = refKSpace( surface );
1347 surfels.insert( surface->begin(), surface->end() );
1349 }

â—† makeIdxDigitalSurface() [4/4]

template<typename TKSpace>
CountedPtr< IdxDigitalSurface > DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface ( CountedPtr< BinaryImage > bimage,
const KSpace & K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds an indexed digital surface from a space K and a binary image bimage. Note that it may connected or not depending on parameters.

Parameters
[in]bimagea binary image representing the characteristic function of a digital shape.
[in]Kthe Khalimsky space whose domain encompasses the digital shape.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
  • nbTriesToFindABel [100000]: number of tries in method Surfaces::findABel
  • surfaceComponents ["AnyBig"]: "AnyBig"|"All", "AnyBig": any big-enough component (> twice space width), "All": all components
Returns
a smart pointer on the required indexed digital surface.

Definition at line 1275 of file Shortcuts.h.

1279 {
1280 std::string component = params[ "surfaceComponents" ].as<std::string>();
1282 if ( component == "AnyBig" )
1283 {
1285 surfels.insert( light_surface->begin(), light_surface->end() );
1286 }
1287 else if ( component == "All" )
1288 {
1290 K.lowerBound(), K.upperBound() );
1291 }
1293 }
static CountedPtr< LightDigitalSurface > makeLightDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1063

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeIdxDigitalSurface(), DGtal::Shortcuts< Z3i::KSpace >::makeIdxDigitalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::makeIdxDigitalSurface().

â—† makeImplicitShape3D()

template<typename TKSpace>
CountedPtr< ImplicitShape3D > DGtal::Shortcuts< TKSpace >::makeImplicitShape3D ( const Parameters & params = parametersImplicitShape3D())
inlinestatic

Builds a 3D implicit shape from parameters

Parameters
[in]paramsthe parameters:
  • polynomial["sphere1"]: the implicit polynomial whose zero-level set defines the shape of interest.
Returns
a smart pointer on the created implicit shape.

Definition at line 283 of file Shortcuts.h.

284 {
286 std::string poly_str = params[ "polynomial" ].as<std::string>();
287 // Recognizes specific strings as polynomials.
288 auto PL = getPolynomialList();
289 if ( PL[ poly_str ] != "" ) poly_str = PL[ poly_str ];
293 = reader.read( poly, poly_str.begin(), poly_str.end() );
294 if ( iter != poly_str.end() )
295 {
296 trace.error() << "[Shortcuts::makeImplicitShape3D]"
297 << " ERROR reading polynomial: I read only <"
298 << poly_str.substr( 0, iter - poly_str.begin() )
299 << ">, and I built P=" << poly << std::endl;
300 }
302 }
static std::map< std::string, std::string > getPolynomialList()
Definition Shortcuts.h:237
ImplicitPolynomial3Shape< Space > ImplicitShape3D
Definition Shortcuts.h:138
MPolynomial< Space::dimension, Scalar > ScalarPolynomial
defines a multi-variate polynomial : RealPoint -> Scalar
Definition Shortcuts.h:135

â—† makeLightDigitalSurface()

template<typename TKSpace>
CountedPtr< LightDigitalSurface > DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface ( CountedPtr< BinaryImage > bimage,
const KSpace & K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Builds a light digital surface from a space K and a binary image bimage.

Parameters
[in]bimagea binary image representing the characteristic function of a digital shape.
[in]Kthe Khalimsky space whose domain encompasses the digital shape.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
  • nbTriesToFindABel [100000]: number of tries in method Surfaces::findABel
Returns
a smart pointer on a (light) digital surface that represents the boundary of any big component of the digital shape.

Definition at line 1062 of file Shortcuts.h.

1066 {
1067 bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1068 int nb_tries_to_find_a_bel = params[ "nbTriesToFindABel" ].as<int>();
1070
1071 // We have to search for a surfel that belongs to a big connected component.
1073 Surfel bel;
1074 Scalar minsize = bimage->extent().norm();
1075 unsigned int nb_surfels = 0;
1076 unsigned int tries = 0;
1077 do
1078 {
1079 try { // Search initial bel
1081 } catch (DGtal::InputException& e) {
1082 trace.error() << "[Shortcuts::makeLightDigitalSurface]"
1083 << " ERROR Unable to find bel. " << e << std::endl;
1084 return ptrSurface;
1085 }
1086 // this pointer will be acquired by the surface.
1090 ( new LightDigitalSurface( surfContainer ) ); // acquired
1091 nb_surfels = ptrSurface->size();
1092 }
1093 while ( ( nb_surfels < 2 * minsize ) && ( tries++ < 150 ) );
1094 if( tries >= 150 )
1095 trace.warning() << "[Shortcuts::makeLightDigitalSurface]"
1096 << "ERROR cannot find a proper bel in a big enough component."
1097 << std::endl;
1098 return ptrSurface;
1099 }
LightImplicitDigitalSurface< KSpace, BinaryImage > LightSurfaceContainer
Definition Shortcuts.h:153
::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface
defines a connected digital surface over a binary image.
Definition Shortcuts.h:155
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeIdxDigitalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::makeLightDigitalSurfaces().

â—† makeLightDigitalSurfaces() [1/2]

template<typename TKSpace>
std::vector< CountedPtr< LightDigitalSurface > > DGtal::Shortcuts< TKSpace >::makeLightDigitalSurfaces ( CountedPtr< BinaryImage > bimage,
const KSpace & K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Returns a vector containing either all the light digital surfaces in the binary image bimage, or any one of its big components according to parameters.

Parameters
[in]bimagea binary image representing the characteristic function of a digital shape.
[in]Kthe Khalimsky space whose domain encompasses the digital shape.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
  • nbTriesToFindABel [ 100000]: number of tries in method Surfaces::findABel
  • surfaceComponents ["AnyBig"]: "AnyBig"|"All", "AnyBig": any big-enough component (> twice space width), "All": all components
Returns
a vector of smart pointers to the connected (light) digital surfaces present in the binary image.

Definition at line 1119 of file Shortcuts.h.

1123 {
1126 }
static std::vector< CountedPtr< LightDigitalSurface > > makeLightDigitalSurfaces(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1120

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeLightDigitalSurfaces().

â—† makeLightDigitalSurfaces() [2/2]

template<typename TKSpace>
std::vector< CountedPtr< LightDigitalSurface > > DGtal::Shortcuts< TKSpace >::makeLightDigitalSurfaces ( SurfelRange & surfel_reps,
CountedPtr< BinaryImage > bimage,
const KSpace & K,
const Parameters & params = parametersDigitalSurface() )
inlinestatic

Returns a vector containing either all the light digital surfaces in the binary image bimage, or any one of its big components according to parameters.

Parameters
[out]surfel_repsa vector of surfels, one surfel per digital surface component.
[in]bimagea binary image representing the characteristic function of a digital shape.
[in]Kthe Khalimsky space whose domain encompasses the digital shape.
[in]paramsthe parameters:
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
  • nbTriesToFindABel [ 100000]: number of tries in method Surfaces::findABel
  • surfaceComponents ["AnyBig"]: "AnyBig"|"All", "AnyBig": any big-enough component (> twice space width), "All": all components
Returns
a vector of smart pointers to the connected (light) digital surfaces present in the binary image.

Definition at line 1149 of file Shortcuts.h.

1154 {
1156 std::string component = params[ "surfaceComponents" ].as<std::string>();
1157 if ( component == "AnyBig" )
1158 {
1159 result.push_back( makeLightDigitalSurface( bimage, K, params ) );
1160 surfel_reps.push_back( *( result[ 0 ]->begin() ) );
1161 return result;
1162 }
1163 bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1165 // Extracts all boundary surfels
1168 K.lowerBound(), K.upperBound() );
1169 // Builds all connected components of surfels.
1172 for ( auto bel : all_surfels )
1173 {
1174 if ( marked_surfels.count( bel ) != 0 ) continue;
1175 surfel_reps.push_back( bel );
1179 ( new LightDigitalSurface( surfContainer ) ); // acquired
1180 // mark all surfels of the surface component.
1181 marked_surfels.insert( ptrSurface->begin(), ptrSurface->end() );
1182 // add surface component to result.
1183 result.push_back( ptrSurface );
1184 }
1185 return result;
1186 }

â—† makeMesh() [1/2]

template<typename TKSpace>
CountedPtr< Mesh > DGtal::Shortcuts< TKSpace >::makeMesh ( CountedPtr< PolygonalSurface > polySurf,
const Color & aColor = Color::White )
inlinestatic

Builds a mesh (class Mesh) from a polygonal surface (class PolygonalSurface). Note that the mesh looses the topology of the polygonal surface, since it is essentially a soup of triangles.

Parameters
[in]polySurfthe input polygonal surface mesh.
[in]aColorthe default color of the mesh.
Returns
a smart pointer on the output mesh.

Definition at line 2089 of file Shortcuts.h.

2091 {
2092 auto pMesh = CountedPtr<Mesh>( new Mesh( aColor ) ); // acquired
2094 return pMesh;
2095 }
static void polygonalSurface2Mesh(const PolygonalSurface< Point > &polysurf, Mesh< Point > &mesh)
::DGtal::Mesh< RealPoint > Mesh
Definition Shortcuts.h:185

â—† makeMesh() [2/2]

template<typename TKSpace>
CountedPtr< Mesh > DGtal::Shortcuts< TKSpace >::makeMesh ( CountedPtr< TriangulatedSurface > triSurf,
const Color & aColor = Color::White )
inlinestatic

Builds a mesh (class Mesh) from a triangulated surface (class TriangulatedSurface). Note that the mesh looses the topology of the triangulated surface, since it is essentially a soup of triangles.

Parameters
[in]triSurfthe input triangulated surface mesh.
[in]aColorthe default color of the mesh.
Returns
a smart pointer on the output mesh.

Definition at line 2072 of file Shortcuts.h.

2074 {
2075 auto pMesh = CountedPtr<Mesh>( new Mesh( aColor ) ); // acquired
2077 return pMesh;
2078 }
static void triangulatedSurface2Mesh(const TriangulatedSurface< Point > &trisurf, Mesh< Point > &mesh)

â—† makePolygonalSurface() [1/2]

template<typename TKSpace>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makePolygonalSurface ( CountedPtr< GrayScaleImage > gray_scale_image,
const Parameters & params = parametersKSpace() | parametersBinaryImage() | parametersDigitalSurface() )
inlinestatic

Builds the polygonal marching-cubes surface that approximate an iso-surface of value "thresholdMin+0.5" in the given 3D gray-scale image.

Parameters
[in]gray_scale_imageany gray-scale image.
[in]paramsthe parameters:
  • surfelAdjacency[0]: specifies the surfel adjacency (1:ext, 0:int)
  • thresholdMin [0]: specifies the threshold min (excluded) to define binary shape
  • gridsizex [1.0]: specifies the space between points along x.
  • gridsizey [1.0]: specifies the space between points along y.
  • gridsizez [1.0]: specifies the space between points along z.
Returns
a smart pointer on the built polygonal surface or 0 if the mesh was invalid.

Definition at line 2189 of file Shortcuts.h.

2194 {
2195 auto K = getKSpace( gray_scale_image );
2198 RealVector gh = { params[ "gridsizex" ].as<double>(),
2199 params[ "gridsizey" ].as<double>(),
2200 params[ "gridsizez" ].as<double>() };
2201 double threshold = params[ "thresholdMin" ].as<double>() + 0.5;
2206 pembedder.init( gh );
2210 ( new PolygonalSurface ); // acquired
2213 ( *digSurf, cembedder, *pPolySurf, s2i );
2214 return pPolySurf;
2215 }
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition Shortcuts.h:333
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1210
Space::RealVector RealVector
Vector with floating-point coordinates.
Definition Shortcuts.h:122

â—† makePolygonalSurface() [2/2]

template<typename TKSpace>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makePolygonalSurface ( CountedPtr< Mesh > aMesh)
inlinestatic

Builds a polygon mesh (class PolygonalSurface) from a mesh (class Mesh). The output polygonal surface rebuilds a topology between faces.

Parameters
[in]aMeshany mesh (which should be a valid combinatorial surface).
Returns
a smart pointer on the built polygonal surface or 0 if the mesh was invalid.

Definition at line 2167 of file Shortcuts.h.

2168 {
2170 ( new PolygonalSurface ); // acquired
2172 return ok ? pPolySurf : CountedPtr< PolygonalSurface >( nullptr );
2173 }
static bool mesh2PolygonalSurface(const Mesh< Point > &mesh, PolygonalSurface< Point > &polysurf)

â—† makePrimalPolygonalSurface() [1/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface ( Cell2Index & c2i,
CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface )
inlinestatic

Builds the primal polygonal surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[out]c2ithe map Cell -> Vertex index in the polygonal surface.
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface or 0 if it fails because aSurface is not a combinatorial 2-manifold.

Definition at line 2322 of file Shortcuts.h.

2324 {
2328 ( new PolygonalSurface ); // acquired
2330 ( *aSurface, embedder, *pPolySurf, c2i );
2331 return ok ? pPolySurf : CountedPtr< PolygonalSurface >( nullptr );
2332 }
static bool digitalSurface2PrimalPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, CellMap &cellmap)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makePrimalPolygonalSurface(), and DGtal::Shortcuts< Z3i::KSpace >::makePrimalPolygonalSurface().

â—† makePrimalPolygonalSurface() [2/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface ( CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the primal polygonal surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface or 0 if it fails because aSurface is not a combinatorial 2-manifold.

Definition at line 2342 of file Shortcuts.h.

2343 {
2346 }
static CountedPtr< PolygonalSurface > makePrimalPolygonalSurface(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition Shortcuts.h:2322

â—† makePrimalPolygonalSurface() [3/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< PolygonalSurface > DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface ( CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the primal polygonal surface associated to the given indexed digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany indexed digital surface (e.g. IdxDigitalSurface)
Returns
a smart pointer on the built polygonal surface or 0 if it fails because aSurface is not a combinatorial 2-manifold.

Definition at line 2356 of file Shortcuts.h.

2358 {
2362 }

â—† makePrimalSurfaceMesh() [1/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< SurfaceMesh > DGtal::Shortcuts< TKSpace >::makePrimalSurfaceMesh ( Cell2Index & c2i,
CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface )
inlinestatic

Builds the primal polygonal surface mesh associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[out]c2ithe map Cell -> Vertex index in the polygonal surface.
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface mesh

Definition at line 2373 of file Shortcuts.h.

2375 {
2378 auto pPolySurf = CountedPtr<SurfaceMesh>( new SurfaceMesh ); // acquired
2380 return ok ? pPolySurf : CountedPtr< SurfaceMesh >( nullptr );
2381 }
static bool digitalSurface2PrimalSurfaceMesh(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, SurfaceMesh< typename CellEmbedder::Value, typename CellEmbedder::Value > &polysurf, CellMap &cellmap)
::DGtal::SurfaceMesh< RealPoint, RealPoint > SurfaceMesh
Definition Shortcuts.h:188

Referenced by DGtal::ShortcutsGeometry< Z3i::KSpace >::getCNCGaussianCurvatures(), DGtal::ShortcutsGeometry< Z3i::KSpace >::getCNCMeanCurvatures(), DGtal::ShortcutsGeometry< Z3i::KSpace >::getCNCPrincipalCurvaturesAndDirections(), DGtal::Shortcuts< Z3i::KSpace >::makePrimalSurfaceMesh(), and DGtal::Shortcuts< Z3i::KSpace >::makePrimalSurfaceMesh().

â—† makePrimalSurfaceMesh() [2/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< SurfaceMesh > DGtal::Shortcuts< TKSpace >::makePrimalSurfaceMesh ( CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the primal polygonal surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany digital surface (e.g. DigitalSurface or LightDigitalSurface)
Returns
a smart pointer on the built polygonal surface or 0 if it fails because aSurface is not a combinatorial 2-manifold.

Definition at line 2391 of file Shortcuts.h.

2392 {
2395 }
static CountedPtr< SurfaceMesh > makePrimalSurfaceMesh(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition Shortcuts.h:2373

â—† makePrimalSurfaceMesh() [3/3]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< SurfaceMesh > DGtal::Shortcuts< TKSpace >::makePrimalSurfaceMesh ( CountedPtr< ::DGtal::IndexedDigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the primal polygonal surface associated to the given indexed digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany indexed digital surface (e.g. IdxDigitalSurface)
Returns
a smart pointer on the built polygonal surface or 0 if it fails because aSurface is not a combinatorial 2-manifold.

Definition at line 2405 of file Shortcuts.h.

2406 {
2409 return makePrimalSurfaceMesh( c2i, dsurf );
2410 }

â—† makeSurfaceMesh()

template<typename TKSpace>
CountedPtr< SurfaceMesh > DGtal::Shortcuts< TKSpace >::makeSurfaceMesh ( const std::string & path)
inlinestatic

Loads a surface mesh

Parameters
[in]pathPath to file
Returns
A smart pointer to the loaded polygonal surface, that holds nullptr if loading failed.

Definition at line 2417 of file Shortcuts.h.

2418 {
2420 if (file.is_open())
2421 {
2424
2425 return ok ? surf : CountedPtr<SurfaceMesh>( nullptr );
2426 }
2427
2428 return CountedPtr<SurfaceMesh>( nullptr );
2429 }
static bool readOBJ(std::istream &input, SurfaceMesh &smesh)

â—† makeTriangulatedSurface() [1/5]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< TriangulatedSurface > DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface ( CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
inlinestatic

Builds the dual triangulated surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[in]aSurfaceany digital surface (e.g. LightDigitalSurface or DigitalSurface)
Returns
a smart pointer on the built triangulated surface.

Definition at line 2123 of file Shortcuts.h.

2124 {
2127 }
static CountedPtr< TriangulatedSurface > makeTriangulatedSurface(CountedPtr< Mesh > aMesh)
Definition Shortcuts.h:2055

â—† makeTriangulatedSurface() [2/5]

template<typename TKSpace>
CountedPtr< TriangulatedSurface > DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface ( CountedPtr< GrayScaleImage > gray_scale_image,
const Parameters & params = parametersKSpace() | parametersBinaryImage() | parametersDigitalSurface() )
inlinestatic

Builds the marching-cubes surface that approximate an iso-surface of value "thresholdMin+0.5" in the given 3D gray-scale image. Non triangular faces are triangulated by putting a centroid vertex.

Parameters
[in]gray_scale_imageany gray-scale image.
[in]paramsthe parameters:
  • surfelAdjacency[0]: specifies the surfel adjacency (1:ext, 0:int)
  • thresholdMin [0]: specifies the threshold min (excluded) to define binary shape
  • gridsizex [1.0]: specifies the space between points along x.
  • gridsizey [1.0]: specifies the space between points along y.
  • gridsizez [1.0]: specifies the space between points along z.
Returns
a smart pointer on the built triangulated surface or 0 if the mesh was invalid.

Definition at line 2232 of file Shortcuts.h.

2237 {
2238 auto K = getKSpace( gray_scale_image );
2241 RealVector gh = { params[ "gridsizex" ].as<double>(),
2242 params[ "gridsizey" ].as<double>(),
2243 params[ "gridsizez" ].as<double>() };
2244 double threshold = params[ "thresholdMin" ].as<double>() + 0.5;
2249 pembedder.init( gh );
2253 ( new TriangulatedSurface ); // acquired
2256 ( *digSurf, cembedder, *pPolySurf, s2i );
2257 return pPolySurf;
2258 }
static void digitalSurface2DualTriangulatedSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, TriangulatedSurface< typename CellEmbedder::Value > &trisurf, VertexMap &vertexmap)
::DGtal::TriangulatedSurface< RealPoint > TriangulatedSurface
Definition Shortcuts.h:186

â—† makeTriangulatedSurface() [3/5]

template<typename TKSpace>
CountedPtr< TriangulatedSurface > DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface ( CountedPtr< Mesh > aMesh)
inlinestatic

Builds a triangulated surface (class TriangulatedSurface) from a mesh (class Mesh). Note that a triangulated surface contains only triangles, so polygonal faces (0,1,2,3,4,...) of the input mesh are (naively) triangulated (triangles (0,1,2), (0,2,3), (0,3,4), etc). Furthermore, the output triangulated surface rebuilds a topology between faces.

Parameters
[in]aMeshany mesh (which should be a valid combinatorial surface).
Returns
a smart pointer on the built triangulated surface or 0 if the mesh was invalid.

Definition at line 2055 of file Shortcuts.h.

2056 {
2058 ( new TriangulatedSurface ); // acquired
2060 return ok ? pTriSurf : CountedPtr< TriangulatedSurface >( nullptr );
2061 }
static bool mesh2TriangulatedSurface(const Mesh< Point > &mesh, TriangulatedSurface< Point > &trisurf)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::makeTriangulatedSurface().

â—† makeTriangulatedSurface() [4/5]

template<typename TKSpace>
CountedPtr< TriangulatedSurface > DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface ( CountedPtr< PolygonalSurface > polySurf,
const Parameters & params = parametersMesh() )
inlinestatic

Builds a triangulated surface from a polygonal surface.

Note
Be very careful with "Naive" subdivision, since it may create non-manifold edges on general polygonal surfaces. Indeed, take the closed surface made of faces (0, 1, 2, 3) and (3, 2, 1, 0). Depending on how faces are triangulated, it is still a valid combinatorial triangulated 2-manifold (e.g. (0,1,2,3) gives (0,1,2) and (2,0,3) and (3,2,1,0) gives (3,2,1) and (1,3,0)) or a non-valid one (e.g. (0,1,2,3) gives (0,1,2) and (2,0,3) and (3,2,1,0) gives (3,2,0) and (0,2,1): then edge {2,0} is shared by four faces).
Parameters
[in]polySurfany polygonal surface.
[in]paramsthe parameters:
  • faceSubdivision ["Centroid"]: "No"|"Naive"|"Centroid" specifies how faces are subdivided, "No" is considered as "Naive" since faces must be triangulated.
Returns
a smart pointer on the built triangulated surface.

Definition at line 2147 of file Shortcuts.h.

2149 {
2150 std::string faceSubdivision = params[ "faceSubdivision" ].as<std::string>();
2151 bool centroid = ( faceSubdivision == "Centroid" );
2153 ( new TriangulatedSurface ); // acquired
2155 return pTriSurf;
2156 }
static void polygonalSurface2TriangulatedSurface(const PolygonalSurface< Point > &polysurf, TriangulatedSurface< Point > &trisurf, bool centroid=true)

â—† makeTriangulatedSurface() [5/5]

template<typename TKSpace>
template<typename TContainer>
CountedPtr< TriangulatedSurface > DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface ( Surfel2Index & s2i,
CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface )
inlinestatic

Builds the dual triangulated surface associated to the given digital surface.

Template Parameters
TContainerthe digital surface container
Parameters
[out]s2ithe map Surfel -> Vertex index in the triangulated surface.
[in]aSurfaceany digital surface (e.g. LightDigitalSurface or DigitalSurface)
Returns
a smart pointer on the built triangulated surface.

Definition at line 2105 of file Shortcuts.h.

â—† operator=() [1/2]

template<typename TKSpace>
Shortcuts & DGtal::Shortcuts< TKSpace >::operator= ( const Shortcuts< TKSpace > & other)
delete

Copy assignment operator.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

â—† operator=() [2/2]

template<typename TKSpace>
Shortcuts & DGtal::Shortcuts< TKSpace >::operator= ( Shortcuts< TKSpace > && other)
delete

Move assignment operator.

Parameters
otherthe object to move.
Returns
a reference on 'this'.

â—† outputCellMapAsCSV()

template<typename TKSpace>
template<typename TCellMap, typename TValueWriter>
bool DGtal::Shortcuts< TKSpace >::outputCellMapAsCSV ( std::ostream & output,
const KSpace & K,
const TCellMap & anyMap,
const TValueWriter & writer )
inlinestatic

Definition at line 3225 of file Shortcuts.h.

3230 {
3231 CellWriter w;
3232 for ( auto&& v : anyMap )
3233 {
3234 w( output, K, v.first );
3235 writer( output, v.second );
3236 output << std::endl;
3237 }
3238 return output.good();
3239 }

â—† outputDualDigitalSurfaceAsObj() [1/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
bool DGtal::Shortcuts< TKSpace >::outputDualDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const Parameters & params = parametersMesh() )
inlinestatic

Outputs a digital surface, seen from the dual point of view (surfels=vertices), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside).

Template Parameters
TDigitalSurfaceContainereither model of concepts::CDigitalSurfaceContainer.
Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on a digital surface (a DigitalSurface or a LightDigitalSurface).
[in]paramsthe parameters:
  • faceSubdivision ["Centroid"]: "No"|"Naive"|"Centroid" specifies how dual faces are subdivided when exported.
Returns
'true' if the output stream is good.

Definition at line 2965 of file Shortcuts.h.

2969 {
2972 }
static bool outputDualDigitalSurfaceAsObj(std::ostream &output, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersMesh())
Definition Shortcuts.h:2966

Referenced by DGtal::Shortcuts< Z3i::KSpace >::outputDualDigitalSurfaceAsObj().

â—† outputDualDigitalSurfaceAsObj() [2/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer, typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
bool DGtal::Shortcuts< TKSpace >::outputDualDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface,
const TCellEmbedder & embedder,
const Parameters & params = parametersMesh() )
inlinestatic

Outputs a digital surface, seen from the dual point of view (surfels=vertices), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside). Each vertex is mapped to a 3D point using the given cell embedder.

Template Parameters
TDigitalSurfaceContainereither model of concepts::CDigitalSurfaceContainer.
TCellEmbedderany model of CCellEmbedder
Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on a digital surface (either DigitalSurface or LightDigitalSurface).
[in]embedderthe embedder for mapping (unsigned) surfels (cells of dimension 2) to points in space.
[in]paramsthe parameters:
  • faceSubdivision ["Centroid"]: "No"|"Naive"|"Centroid" specifies how dual faces are subdivided when exported.
Returns
'true' if the output stream is good.

Definition at line 2999 of file Shortcuts.h.

3004 {
3005 typedef unsigned long Size;
3008 std::string dualFaceSubdivision = params[ "faceSubdivision" ].as<std::string>();
3009 const int subdivide
3010 = dualFaceSubdivision == "Naive" ? 1
3011 : dualFaceSubdivision == "Centroid" ? 2
3012 : 0;
3013 const KSpace& K = embedder.space();
3014 // Number and ouput vertices.
3017 Size n = 1; // OBJ vertex numbering start at 1
3018 for ( auto && s : *surface )
3019 {
3020 if ( ! vtx_numbering.count( s ) )
3021 {
3022 vtx_numbering[ s ] = n++;
3023 // Output vertex positions
3024 RealPoint p = embedder( K.unsigns( s ) );
3025 output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
3026 }
3027 }
3028 auto faces = surface->allClosedFaces();
3029 // Prepare centroids if necessary
3030 if ( subdivide == 2 )
3031 {
3032 for ( auto&& f : faces )
3033 {
3034 auto vtcs = surface->verticesAroundFace( f );
3035 Size nv = vtcs.size();
3036 if ( nv > 3 )
3037 {
3038 sub_numbering[ f ] = n++;
3040 for ( auto&& s : vtcs ) p += embedder( K.unsigns( s ) );
3041 p /= nv;
3042 output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
3043 }
3044 }
3045 }
3046 // Outputs closed faces.
3047 if ( subdivide == 0 )
3048 { // No subdivision
3049 for ( auto&& f : faces )
3050 {
3051 output << "f";
3052 auto vtcs = surface->verticesAroundFace( f );
3053 std::reverse( vtcs.begin(), vtcs.end() );
3054 for ( auto&& s : vtcs )
3055 output << " " << vtx_numbering[ s ];
3056 output << std::endl;
3057 }
3058 }
3059 else if ( subdivide == 1 )
3060 { // naive subdivision
3061 for ( auto&& f : faces )
3062 {
3063 auto vtcs = surface->verticesAroundFace( f );
3064 Size nv = vtcs.size();
3065 for ( Size i = 1; i < nv - 1; ++i )
3066 output << "f " << vtx_numbering[ vtcs[ 0 ] ]
3067 << " " << vtx_numbering[ vtcs[ i+1 ] ]
3068 << " " << vtx_numbering[ vtcs[ i ] ] << std::endl;
3069 }
3070 }
3071 else if ( subdivide == 2 )
3072 { // centroid subdivision
3073 for ( auto&& f : faces )
3074 {
3075 auto vtcs = surface->verticesAroundFace( f );
3076 Size nv = vtcs.size();
3077 if ( nv == 3 )
3078 output << "f " << vtx_numbering[ vtcs[ 0 ] ]
3079 << " " << vtx_numbering[ vtcs[ 2 ] ]
3080 << " " << vtx_numbering[ vtcs[ 1 ] ] << std::endl;
3081 else {
3082 Size c = sub_numbering[ f ];
3083 for ( Size i = 0; i < nv; ++i )
3084 {
3085 output << "f " << c
3086 << " " << vtx_numbering[ vtcs[ (i+1)%nv ] ]
3087 << " " << vtx_numbering[ vtcs[ i ] ] << std::endl;
3088 }
3089 }
3090 }
3091 }
3092 return output.good();
3093 }
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))

â—† outputPrimalDigitalSurfaceAsObj() [1/2]

template<typename TKSpace>
template<typename TAnyDigitalSurface>
bool DGtal::Shortcuts< TKSpace >::outputPrimalDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< TAnyDigitalSurface > surface )
inlinestatic

Outputs a digital surface, seen from the primal point of view (surfels=face), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside).

Template Parameters
TAnyDigitalSurfaceeither kind of DigitalSurface, like Shortcuts::LightDigitalSurface or Shortcuts::DigitalSurface.
Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on a digital surface.
Returns
'true' if the output stream is good.

Definition at line 2865 of file Shortcuts.h.

2868 {
2871 }
static bool outputPrimalDigitalSurfaceAsObj(std::ostream &output, CountedPtr< TAnyDigitalSurface > surface)
Definition Shortcuts.h:2866

Referenced by DGtal::Shortcuts< Z3i::KSpace >::outputPrimalDigitalSurfaceAsObj().

â—† outputPrimalDigitalSurfaceAsObj() [2/2]

template<typename TKSpace>
template<typename TAnyDigitalSurface, typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
bool DGtal::Shortcuts< TKSpace >::outputPrimalDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< TAnyDigitalSurface > surface,
const TCellEmbedder & embedder )
inlinestatic

Outputs a digital surface, seen from the primal point of view (surfels=face), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside). Each vertex is mapped to a 3D point using the given cell embedder.

Template Parameters
TAnyDigitalSurfaceeither kind of DigitalSurface, like Shortcuts::LightDigitalSurface or Shortcuts::DigitalSurface.
TCellEmbedderany model of CCellEmbedder
Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on a digital surface.
[in]embedderthe embedder for mapping surfel vertices (cells of dimension 0) to points in space.
Returns
'true' if the output stream is good.

Definition at line 2893 of file Shortcuts.h.

2897 {
2898 auto surfels = getSurfelRange( surface, Parameters( "Traversal", "Default" ) );
2900 }
static bool outputSurfelsAsObj(std::ostream &output, const SurfelRange &surfels, const TCellEmbedder &embedder)
Definition Shortcuts.h:2815

â—† outputPrimalIdxDigitalSurfaceAsObj() [1/2]

template<typename TKSpace>
bool DGtal::Shortcuts< TKSpace >::outputPrimalIdxDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< IdxDigitalSurface > surface )
inlinestatic

Outputs an indexed digital surface, seen from the primal point of view (surfels=face), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside).

Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on an indexed digital surface.
Returns
'true' if the output stream is good.

Definition at line 2911 of file Shortcuts.h.

2914 {
2917 }
static bool outputPrimalIdxDigitalSurfaceAsObj(std::ostream &output, CountedPtr< IdxDigitalSurface > surface)
Definition Shortcuts.h:2912

Referenced by DGtal::Shortcuts< Z3i::KSpace >::outputPrimalIdxDigitalSurfaceAsObj().

â—† outputPrimalIdxDigitalSurfaceAsObj() [2/2]

template<typename TKSpace>
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
bool DGtal::Shortcuts< TKSpace >::outputPrimalIdxDigitalSurfaceAsObj ( std::ostream & output,
CountedPtr< IdxDigitalSurface > surface,
const TCellEmbedder & embedder )
inlinestatic

Outputs an indexed digital surface, seen from the primal point of view (surfels=face), as an OBJ file (3D only). Note that faces are oriented consistently (normals toward outside). Each vertex is mapped to a 3D point using the given cell embedder.

Template Parameters
TCellEmbedderany model of CCellEmbedder
Parameters
[out]outputthe output stream.
[in]surfacea smart pointer on an indexed digital surface.
[in]embedderthe embedder for mapping surfel vertices (cells of dimension 0) to points in space.
Returns
'true' if the output stream is good.

Definition at line 2934 of file Shortcuts.h.

2938 {
2939 auto idxsurfels = getIdxSurfelRange( surface, Parameters( "Traversal", "Default" ) );
2940 auto surfelmap = surface->surfels();
2942 for ( auto&& idx : idxsurfels )
2943 surfels.push_back( surfelmap[ idx ] );
2945 }

â—† outputSCellMapAsCSV()

template<typename TKSpace>
template<typename TSCellMap, typename TValueWriter>
bool DGtal::Shortcuts< TKSpace >::outputSCellMapAsCSV ( std::ostream & output,
const KSpace & K,
const TSCellMap & anyMap,
const TValueWriter & writer )
inlinestatic

Definition at line 3195 of file Shortcuts.h.

3200 {
3201 SCellWriter w;
3202 for ( auto&& v : anyMap )
3203 {
3204 w( output, K, v.first );
3205 writer( output, v.second );
3206 output << std::endl;
3207 }
3208 return output.good();
3209 }

â—† outputSurfelsAsObj()

template<typename TKSpace>
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
bool DGtal::Shortcuts< TKSpace >::outputSurfelsAsObj ( std::ostream & output,
const SurfelRange & surfels,
const TCellEmbedder & embedder )
inlinestatic

Outputs a range of surfels as an OBJ file, embedding each vertex using the given cell embedder (3D only).

Template Parameters
TCellEmbedderany model of CCellEmbedder
Parameters
[out]outputthe output stream.
[in]surfelsthe range of surfels (oriented cells of dimension 2).
[in]embedderthe embedder for mapping surfel vertices (cells of dimension 0) to points in space.
Returns
'true' if the output stream is good.

Definition at line 2814 of file Shortcuts.h.

2818 {
2819 typedef unsigned long Size;
2822 const KSpace& K = embedder.space();
2823 // Number and output vertices.
2825 Size n = 1; // OBJ vertex numbering start at 1
2826 for ( auto&& s : surfels )
2827 {
2828 auto primal_vtcs = getPointelRange( K, s, true );
2829 for ( auto&& primal_vtx : primal_vtcs )
2830 {
2831 if ( ! vtx_numbering.count( primal_vtx ) )
2832 {
2833 vtx_numbering[ primal_vtx ] = n++;
2834 // Output vertex positions
2836 output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
2837 }
2838 }
2839 }
2840 // Outputs all faces
2841 for ( auto&& s : surfels )
2842 {
2843 output << "f";
2844 auto primal_vtcs = getPointelRange( K, s, true );
2845 for ( auto&& primal_vtx : primal_vtcs )
2846 output << " " << vtx_numbering[ primal_vtx ];
2847 output << std::endl;
2848 }
2849 return output.good();
2850 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::outputPrimalDigitalSurfaceAsObj(), and DGtal::Shortcuts< Z3i::KSpace >::outputPrimalIdxDigitalSurfaceAsObj().

â—† parametersBinaryImage()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersBinaryImage ( )
inlinestatic
Returns
the parameters and their default values which are related to binary images and synthetic noise.
  • noise [0.0]: specifies the Kanungo noise level for binary pictures.
  • thresholdMin [ 0]: specifies the threshold min (excluded) to define binary shape
  • thresholdMax [255]: specifies the threshold max (included) to define binary shape

Definition at line 548 of file Shortcuts.h.

549 {
550 return Parameters
551 ( "noise", 0.0 )
552 ( "thresholdMin", 0 )
553 ( "thresholdMax", 255 );
554 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersDigitalSurface()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersDigitalSurface ( )
inlinestatic
Returns
the parameters and their default values which are related to digital surfaces.
  • surfelAdjacency [ 0]: specifies the surfel adjacency (1:ext, 0:int)
  • nbTriesToFindABel [ 100000]: number of tries in method Surfaces::findABel
  • surfaceComponents [ "AnyBig"]: "AnyBig"|"All", "AnyBig": any big-enough componen
  • surfaceTraversal ["Default"]: "Default"|"DepthFirst"|"BreadthFirst": "Default" default surface traversal, "DepthFirst": depth-first surface traversal, "BreadthFirst": breadth-first surface traversal.

Definition at line 997 of file Shortcuts.h.

998 {
999 return Parameters
1000 ( "surfelAdjacency", 0 )
1001 ( "nbTriesToFindABel", 100000 )
1002 ( "surfaceComponents", "AnyBig" )
1003 ( "surfaceTraversal", "Default" );
1004 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersDigitizedImplicitShape3D()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersDigitizedImplicitShape3D ( )
inlinestatic
Returns
the parameters and their default values which are used for digitization.
  • minAABB [-10.0]: the min value of the AABB bounding box (domain)
  • maxAABB [ 10.0]: the max value of the AABB bounding box (domain)
  • gridstep [ 1.0]: the gridstep that defines the digitization (often called h).
  • offset [ 5.0]: the digital dilation of the digital space, useful when you process shapes and that you add noise.

Definition at line 462 of file Shortcuts.h.

463 {
464 return Parameters
465 ( "minAABB", -10.0 )
466 ( "maxAABB", 10.0 )
467 ( "gridstep", 1.0 )
468 ( "offset", 5.0 );
469 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersGrayScaleImage()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersGrayScaleImage ( )
inlinestatic
Returns
the parameters and their default values which are used for quantification.
  • qShift [128.0]: the shift used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).
  • qSlope [ 1.0]: the slope used when quantifying the implicit shape (q(x)=qSlope*x+qShift, e.g. to build a grayscale image).

Definition at line 724 of file Shortcuts.h.

725 {
726 return Parameters
727 ( "qShift", 128.0 )
728 ( "qSlope", 1.0 );
729 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersImplicitShape3D()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersImplicitShape3D ( )
inlinestatic
Returns
the parameters and their default values which are used to define an implicit shape.
  • polynomial ["sphere1"]: the implicit polynomial whose zero-level set defines the shape of interest.
  • projectionMaxIter [ 20]: the maximum number of iteration for the projection.
  • projectionAccuracy[0.0001]: the zero-proximity stop criterion during projection.
  • projectionGamma [ 0.5]: the damping coefficient of the projection.

Definition at line 266 of file Shortcuts.h.

267 {
268 return Parameters
269 ( "polynomial", "sphere1" )
270 ( "projectionMaxIter", 20 )
271 ( "projectionAccuracy", 0.0001 )
272 ( "projectionGamma", 0.5 );
273 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersKSpace()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersKSpace ( )
inlinestatic
Returns
the parameters and their default values which are used for digitization.
  • closed [1 ]: specifies if the Khalimsky space is closed (!=0) or not (==0).
  • gridsizex[1.0]: specifies the space between points along x.
  • gridsizey[1.0]: specifies the space between points along y.
  • gridsizez[1.0]: specifies the space between points along z.

Definition at line 312 of file Shortcuts.h.

313 {
314 return Parameters
315 ( "closed", 1 )
316 ( "gridsizex", 1.0 )
317 ( "gridsizey", 1.0 )
318 ( "gridsizez", 1.0 );
319 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersMesh()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersMesh ( )
inlinestatic
Returns
the parameters and their default values which are related to meshes.
  • faceSubdivision ["Centroid"]: "No"|"Naive"|"Centroid" specifies how polygonal faces should be subdivided when triangulated or when exported.

Definition at line 2037 of file Shortcuts.h.

2038 {
2039 return Parameters
2040 ( "faceSubdivision", "Centroid" );
2041 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† parametersUtilities()

template<typename TKSpace>
Parameters DGtal::Shortcuts< TKSpace >::parametersUtilities ( )
inlinestatic
Returns
the parameters and their default values which are related to utilities
  • colormap [ "Custom" ]: "Cool"|"Copper"|"Hot"|"Jet"|"Spring"|"Summer"|"Autumn"|"Winter"|"Error"|"Custom" specifies standard colormaps (if invalid, falls back to "Custom").
  • zero-tic [ 0.0 ]: if positive defines a black zone ]-zt,zt[ in the colormap.

Definition at line 2676 of file Shortcuts.h.

2677 {
2678 return Parameters
2679 ( "colormap", "Custom" )
2680 ( "zero-tic", 0.0 );
2681 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::defaultParameters().

â—† refKSpace() [1/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
const KSpace & DGtal::Shortcuts< TKSpace >::refKSpace ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on a (light or not) digital surface (e.g. DigitalSurface or LightDigitalSurface).
Returns
a const reference to the Khalimsky space associated to the given surface.

Definition at line 419 of file Shortcuts.h.

421 {
422 return surface->container().space();
423 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::getCellEmbedder(), DGtal::Shortcuts< Z3i::KSpace >::getCellEmbedder(), DGtal::Shortcuts< Z3i::KSpace >::getCellRange(), DGtal::Shortcuts< Z3i::KSpace >::getPointelRange(), DGtal::Shortcuts< Z3i::KSpace >::getSCellEmbedder(), DGtal::Shortcuts< Z3i::KSpace >::getSCellEmbedder(), DGtal::Shortcuts< Z3i::KSpace >::makeDigitalSurface(), DGtal::Shortcuts< Z3i::KSpace >::makeIdxDigitalSurface(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), and DGtal::Shortcuts< Z3i::KSpace >::saveOFF().

â—† refKSpace() [2/2]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
const KSpace & DGtal::Shortcuts< TKSpace >::refKSpace ( CountedPtr< ::DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer > > surface)
inlinestatic
Template Parameters
TDigitalSurfaceContainereither kind of DigitalSurfaceContainer
Parameters
[in]surfacea smart pointer on any indexed digital surface.
Returns
a const reference to the Khalimsky space associated to the given surface.

Definition at line 430 of file Shortcuts.h.

432 {
433 return surface->container().space();
434 }

â—† saveBinaryImage()

template<typename TKSpace>
bool DGtal::Shortcuts< TKSpace >::saveBinaryImage ( CountedPtr< BinaryImage > bimage,
std::string output )
inlinestatic

Saves an arbitrary binary image file (e.g. vol file in 3D).

Parameters
[in]bimagethe input binary image.
[in]outputthe output filename .
Returns
'true' if everything went well, 'false' if there was an error during save.

Definition at line 708 of file Shortcuts.h.

710 {
713 }
static bool saveGrayScaleImage(CountedPtr< GrayScaleImage > gray_scale_image, std::string output)
Definition Shortcuts.h:785

â—† saveGrayScaleImage()

template<typename TKSpace>
bool DGtal::Shortcuts< TKSpace >::saveGrayScaleImage ( CountedPtr< GrayScaleImage > gray_scale_image,
std::string output )
inlinestatic

Saves an arbitrary gray-scale image file (e.g. vol file in 3D).

Parameters
[in]gray_scale_imagethe input gray-scale image.
[in]outputthe output filename .
Returns
'true' if everything went well, 'false' if there was an error during save.

Definition at line 784 of file Shortcuts.h.

Referenced by DGtal::Shortcuts< Z3i::KSpace >::saveBinaryImage().

â—† saveOBJ() [1/9]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf,
const RealVectors & normals,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a digital surface as an OBJ file (with its topology) and a material MTL file. Optionnaly you can specify the surfels normals and diffuse colors. Here surfels are canonically embedded into the space.

Template Parameters
TDigitalSurfaceContainerany model of concepts::CDigitalSurfaceContainer
Parameters
[in]digsurfthe digital surface to output as an OBJ file
[in]normalsthe normal vector per face.
[in]diffuse_colorseither empty or a vector of size trisurf.nbFaces specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 1859 of file Shortcuts.h.

1867 {
1871 }
static bool saveOBJ(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
Definition Shortcuts.h:1740

â—† saveOBJ() [2/9]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer, typename TCellEmbedder>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf,
const TCellEmbedder & embedder,
const RealVectors & normals,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a digital surface as an OBJ file (with its topology) and a material MTL file. Optionnaly you can specify the surfels normals and diffuse colors, and even specify how 0-cells are embedded into the space.

Template Parameters
TDigitalSurfaceContainerany model of concepts::CDigitalSurfaceContainer
TCellEmbedderany type for maping Cell -> RealPoint.
Parameters
[in]digsurfthe digital surface to output as an OBJ file
[in]embedderany map Cell->RealPoint
[in]normalsthe normal vector per face.
[in]diffuse_colorseither empty or a vector of size trisurf.nbFaces specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 1739 of file Shortcuts.h.

1748 {
1751 auto lastindex = objfile.find_last_of(".");
1753 {
1754 mtlfile = objfile + ".mtl";
1755 objfile = objfile + ".obj";
1756 }
1757 else
1758 {
1759 mtlfile = objfile.substr(0, lastindex) + ".mtl";
1760 }
1761
1762 std::ofstream output_obj( objfile.c_str() );
1763 output_obj << "# OBJ format" << std::endl;
1764 output_obj << "# DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor" << std::endl;
1765 output_obj << "o anObject" << std::endl;
1766 //remove directory to write material
1767 auto indexpath = objfile.find_last_of("/");
1768 output_obj << "mtllib " << mtlfile.substr(indexpath+1) << std::endl;
1769 std::ofstream output_mtl( mtlfile.c_str() );
1770 output_mtl << "# MTL format"<< std::endl;
1771 output_mtl << "# generated from MeshWriter from the DGTal library"<< std::endl;
1772 // Number and output vertices.
1773 const KSpace& K = refKSpace( digsurf );
1776 for ( auto&& pointel : pointels )
1777 {
1779 output_obj << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
1780 }
1781 // Taking care of normals
1782 Idx nbfaces = digsurf->size();
1783 bool has_normals = ( nbfaces == normals.size() );
1784 if ( has_normals )
1785 {
1786 for ( Idx f = 0; f < nbfaces; ++f )
1787 {
1788 const auto& p = normals[ f ];
1789 output_obj << "vn " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
1790 }
1791 }
1792 // Taking care of materials
1793 bool has_material = ( nbfaces == diffuse_colors.size() );
1794 Idx idxMaterial = 0;
1796 if ( has_material )
1797 {
1798 for ( Idx f = 0; f < nbfaces; ++f )
1799 {
1800 Color c = diffuse_colors[ f ];
1801 if ( mapMaterial.count( c ) == 0 )
1802 {
1805 mapMaterial[ c ] = idxMaterial++;
1806 }
1807 }
1808 }
1809 else
1810 {
1813 }
1814
1815 // Taking care of faces
1816 Idx f = 0;
1817 for ( auto&& surfel : *digsurf )
1818 {
1819 output_obj << "usemtl material_"
1821 << std::endl;
1822 output_obj << "f";
1824 // The +1 in lines below is because indexing starts at 1 in OBJ file format.
1825 if ( has_normals )
1826 {
1827 for ( auto&& primal_vtx : primal_vtcs )
1828 output_obj << " " << (c2i[ primal_vtx ]+1) << "//" << (f+1);
1829 }
1830 else
1831 {
1832 for ( auto&& primal_vtx : primal_vtcs )
1833 output_obj << " " << (c2i[ primal_vtx ]+1);
1834 }
1836 f += 1;
1837 }
1838 output_mtl.close();
1839 return output_obj.good();
1840 }
static bool exportMTLNewMaterial(std::ostream &output_mtl, unsigned long idxMaterial, const Color &ambient_color, const Color &diffuse_color, const Color &specular_color)

Referenced by DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), and DGtal::Shortcuts< Z3i::KSpace >::saveOBJ().

â—† saveOBJ() [3/9]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a digital surface as an OBJ file (with its topology) and a simple MTL file. Here surfels are canonically embedded into the space.

Template Parameters
TDigitalSurfaceContainerany model of concepts::CDigitalSurfaceContainer
Parameters
[in]digsurfthe digital surface to output as an OBJ file
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 1910 of file Shortcuts.h.

1916 {
1920 }
std::vector< Color > Colors
Definition Shortcuts.h:193
std::vector< RealVector > RealVectors
Definition Shortcuts.h:180

â—† saveOBJ() [4/9]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf,
const RealVectors & normals,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a polygonal surface as an OBJ file (with its topology) (and a material MTL file).

Template Parameters
TPointany model of point
Parameters
[in]polysurfthe polygonal surface to output as an OBJ file
[in]normalsthe normal vector per face.
[in]diffuse_colorseither empty or a vector of size polysurf.nbFaces specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 2528 of file Shortcuts.h.

2536 {
2538 auto lastindex = objfile.find_last_of(".");
2540 {
2541 mtlfile = objfile + ".mtl";
2542 objfile = objfile + ".obj";
2543 }
2544 else
2545 {
2546 mtlfile = objfile.substr(0, lastindex) + ".mtl";
2547 }
2548 std::ofstream output( objfile.c_str() );
2552 output.close();
2553 return ok;
2554 }
static bool exportOBJwithFaceNormalAndColor(std::ostream &output_obj, const std::string &mtl_filename, const SurfaceMesh &surf, const std::vector< typename SurfaceMesh::RealPoint > &normals, const std::vector< Color > &diffuse_colors, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)

â—† saveOBJ() [5/9]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf,
const std::string & objfile )
inlinestatic

Outputs a polygonal surface as an OBJ file (with its topology).

Template Parameters
TPointany model of point
Parameters
[in]polysurfthe polygonal surface to output as an OBJ file
[in]objfilethe output filename.
Returns
'true' if the output stream is good.

Definition at line 2459 of file Shortcuts.h.

2462 {
2463 std::ofstream output( objfile.c_str() );
2465 output.close();
2466 return ok;
2467 }
static bool exportOBJ(std::ostream &output, const TriangulatedSurface< Point > &trisurf)

â—† saveOBJ() [6/9]

template<typename TKSpace>
template<typename TPoint, typename TVector>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::SurfaceMesh< TPoint, TVector > > surf,
const RealVectors & normals,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a SurfaceMesh as an OBJ file (with its topology) (and a material MTL file).

Template Parameters
TPointany model of point
TVectorany model of vector
Parameters
[in]surfthe surface to output as an OBJ file
[in]normalsthe normal vector per face.
[in]diffuse_colorseither empty or a vector of size trisurf.nbFaces specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 2613 of file Shortcuts.h.

2621 {
2623 auto lastindex = objfile.find_last_of(".");
2625 {
2626 mtlfile = objfile + ".mtl";
2627 objfile = objfile + ".obj";
2628 }
2629 else
2630 {
2631 mtlfile = objfile.substr(0, lastindex) + ".mtl";
2632 }
2633 std::ofstream output( objfile.c_str() );
2637 output.close();
2638 return ok;
2639 }

â—† saveOBJ() [7/9]

template<typename TKSpace>
template<typename TPoint, typename TVector>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::SurfaceMesh< TPoint, TVector > > surf,
const std::string & objfile )
inlinestatic

Outputs a SurfaceMesh as an OBJ file (with its topology).

Template Parameters
TPointany model of point
TVectorany model of vector
Parameters
[in]surfthe surface to output as an OBJ file
[in]objfilethe output filename.
Returns
'true' if the output stream is good.

Definition at line 2441 of file Shortcuts.h.

2444 {
2445 std::ofstream output( objfile.c_str() );
2447 output.close();
2448 return ok;
2449 }

â—† saveOBJ() [8/9]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf,
const RealVectors & normals,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs a triangulated surface as an OBJ file (with its topology) (and a material MTL file).

Template Parameters
TPointany model of point
Parameters
[in]trisurfthe triangulated surface to output as an OBJ file
[in]normalsthe normal vector per face.
[in]diffuse_colorseither empty or a vector of size trisurf.nbFaces specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all faces.
[in]diffuse_colorthe diffuse color of all faces (if diffuse_colors is empty).
[in]specular_colorthe specular color of all faces.
Returns
'true' if the output stream is good.

Definition at line 2570 of file Shortcuts.h.

2578 {
2580 auto lastindex = objfile.find_last_of(".");
2582 {
2583 mtlfile = objfile + ".mtl";
2584 objfile = objfile + ".obj";
2585 }
2586 else
2587 {
2588 mtlfile = objfile.substr(0, lastindex) + ".mtl";
2589 }
2590 std::ofstream output( objfile.c_str() );
2594 output.close();
2595 return ok;
2596 }

â—† saveOBJ() [9/9]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOBJ ( CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf,
const std::string & objfile )
inlinestatic

Outputs a triangulated surface as an OBJ file (with its topology).

Template Parameters
TPointany model of point
Parameters
[in]trisurfthe triangulated surface to output as an OBJ file
[in]objfilethe output filename.
Returns
'true' if the output stream is good.

Definition at line 2504 of file Shortcuts.h.

2507 {
2508 std::ofstream output( objfile.c_str() );
2510 output.close();
2511 return ok;
2512 }

â—† saveOFF() [1/4]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer, typename TCellEmbedder>
bool DGtal::Shortcuts< TKSpace >::saveOFF ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf,
const TCellEmbedder & embedder,
std::string off_file,
const Color & face_color = DGtal::Color::None )
inlinestatic

Outputs a digital surface as an OFF file (with its topology). Optionnaly you can specify the face colors (see saveOBJ for a more advanced export).

Template Parameters
TDigitalSurfaceContainerany model of concepts::CDigitalSurfaceContainer
TCellEmbedderany type for maping Cell -> RealPoint.
Parameters
[in]digsurfthe digital surface to output as an OBJ file
[in]embedderany map Cell->RealPoint
[in]face_colorthe color of every face.
[in]off_filethe output filename.
Returns
'true' if the output stream is good.

Definition at line 1673 of file Shortcuts.h.

1679 {
1681
1683 output_off << "OFF" << std::endl;
1684 output_off << "# Generated from DGtal::Shortcuts from the DGTal library" << std::endl;
1687 output_off << pointels.size() << " " << digsurf->size() << " " << 0 << " " << std::endl;
1688
1689
1690 // Number and output vertices.
1691 const KSpace& K = refKSpace( digsurf );
1692 for ( auto&& pointel : pointels )
1693 {
1695 output_off << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
1696 }
1697
1698 // Taking care of faces
1699 for ( auto&& surfel : *digsurf )
1700 {
1702 output_off << primal_vtcs.size();
1703 {
1704 for ( auto&& primal_vtx : primal_vtcs )
1705 output_off << " " << (c2i[ primal_vtx ]);
1706 }
1708 {
1709 output_off << " ";
1710 output_off << face_color.r() << " " << face_color.g()
1711 << " " << face_color.b() << " " << face_color.a();
1712 }
1714 }
1715 return output_off.good();
1716 }

Referenced by DGtal::Shortcuts< Z3i::KSpace >::saveOFF().

â—† saveOFF() [2/4]

template<typename TKSpace>
template<typename TDigitalSurfaceContainer>
bool DGtal::Shortcuts< TKSpace >::saveOFF ( CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf,
std::string off_file,
const Color & face_color = Color( 32, 32, 32 ) )
inlinestatic

Outputs a digital surface as an OFF file (with its topology). Here surfels are canonically embedded into the space. Optionnaly you can specify the face colors (see saveOBJ for a more advanced export).

Outputs a digital surface as an OFF.

Template Parameters
TDigitalSurfaceContainerany model of concepts::CDigitalSurfaceContainer
Parameters
[in]digsurfthe digital surface to output as an OBJ file
[in]off_filethe output filename.
[in]face_colorthe color of every face.
Returns
'true' if the output stream is good.

Definition at line 1888 of file Shortcuts.h.

1892 {
1895 }
static bool saveOFF(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, std::string off_file, const Color &face_color=DGtal::Color::None)
Definition Shortcuts.h:1674

â—† saveOFF() [3/4]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOFF ( CountedPtr< ::DGtal::PolygonalSurface< TPoint > > polysurf,
std::string off_file,
const Color & face_color = DGtal::Color::None )
inlinestatic

Outputs a triangulated surface as an OFF file.

Template Parameters
TPointany model of point
Parameters
[in]polysurfthe polygonal surface to output as an OBJ file
[in]off_filethe output filename.
[in]face_colorthe color of every face.
Returns
'true' if the output stream is good.

Definition at line 2479 of file Shortcuts.h.

2483 {
2486 std::ofstream output( off_file.c_str() );
2487 for (unsigned int i=0; i< m.nbFaces(); i++)
2488 {
2489 m.setFaceColor(i, face_color);
2490 }
2492 output.close();
2493 return ok;
2494 }
static bool export2OFF(std::ostream &out, const Mesh< TPoint > &aMesh, bool exportColor=true)

â—† saveOFF() [4/4]

template<typename TKSpace>
template<typename TPoint>
bool DGtal::Shortcuts< TKSpace >::saveOFF ( CountedPtr< ::DGtal::TriangulatedSurface< TPoint > > trisurf,
std::string off_file,
const Color & face_color = DGtal::Color::None )
inlinestatic

Outputs a triangulated surface as an OFF file.

Template Parameters
TPointany model of point
Parameters
[in]trisurfthe triangulated surface to output as an OBJ file
[in]off_filethe output filename.
[in]face_colorthe color of all faces.
Returns
'true' if the output stream is good.

Definition at line 2651 of file Shortcuts.h.

2655 {
2658 std::ofstream output( off_file.c_str() );
2659 for (unsigned int i=0; i< m.nbFaces(); i++)
2660 {
2661 m.setFaceColor(i, face_color);
2662 }
2664 output.close();
2665 return ok;
2666 }

â—† saveVectorFieldOBJ()

template<typename TKSpace>
bool DGtal::Shortcuts< TKSpace >::saveVectorFieldOBJ ( const RealPoints & positions,
const RealVectors & vf,
double thickness,
const Colors & diffuse_colors,
std::string objfile,
const Color & ambient_color = Color( 32, 32, 32 ),
const Color & diffuse_color = Color( 200, 200, 255 ),
const Color & specular_color = Color::White )
inlinestatic

Outputs any vector field vf anchored at positions as an OBJ file and a material MTL file. Optionnaly you can specify the diffuse colors.

Parameters
[in]positionsthe bases of the vectors of the vector field.
[in]vfthe vector field (an array of real vectors).
[in]thicknessthe thickness of the sticks representing the vector field.
[in]diffuse_colorseither empty or a vector of size normals.size() specifying the diffuse color for each face.
[in]objfilethe output filename.
[in]ambient_colorthe ambient color of all vectors.
[in]diffuse_colorthe diffuse color of all vectors (if diffuse_colors is empty).
[in]specular_colorthe specular color of all vectors.
Returns
'true' if the output stream is good.
Note
It outputs only the vector field, not the surface onto which it is defined (if any).

Definition at line 1939 of file Shortcuts.h.

1948 {
1951 auto lastindex = objfile.find_last_of(".");
1953 {
1954 mtlfile = objfile + ".mtl";
1955 objfile = objfile + ".obj";
1956 }
1957 else
1958 {
1959 mtlfile = objfile.substr(0, lastindex) + ".mtl";
1960 }
1961 std::ofstream output_obj( objfile.c_str() );
1962 output_obj << "# OBJ format" << std::endl;
1963 output_obj << "# DGtal::saveOBJ" << std::endl;
1964 output_obj << "o vectors" << std::endl;
1965 output_obj << "mtllib " << mtlfile << std::endl;
1966 std::ofstream output_mtl( mtlfile.c_str() );
1967 output_mtl << "# MTL format"<< std::endl;
1968 output_mtl << "# generated from MeshWriter from the DGTal library"<< std::endl;
1969 // Output vertices
1970 auto n = std::min( positions.size(), vf.size() );
1971 for ( unsigned int i = 0; i < n; ++i )
1972 {
1973 RealPoint p0 = positions[ i ];
1974 RealPoint p1 = p0 + vf[ i ];
1975 RealVector v = vf[ i ];
1976 RealVector absv = RealVector( fabs( v[ 0 ] ), fabs( v[ 1 ] ), fabs( v[ 2 ] ) );
1977 auto mc = std::max_element( absv.begin(), absv.end() ) - absv.begin();
1978 RealVector b =
1979 mc == 2 ? RealVector( 1, 0, 0 ) :
1980 mc == 1 ? RealVector( 0, 0, 1 ) : RealVector( 0, 1, 0 );
1981 RealVector e0 = v.crossProduct( b ).getNormalized();
1982 RealVector e1 = v.crossProduct( e0 ).getNormalized();
1983 RealPoint t[4] = { thickness * e0, thickness * e1,
1984 -thickness * e0, -thickness * e1 };
1985 for ( unsigned int j = 0; j < 4; ++j ) {
1986 RealPoint pt0 = p0 + t[ j ];
1987 RealPoint pt1 = p1 + t[ j ];
1988 output_obj << "v " << pt0[ 0 ] << " " << pt0[ 1 ] << " " << pt0[ 2 ]
1989 << std::endl;
1990 output_obj << "v " << pt1[ 0 ] << " " << pt1[ 1 ] << " " << pt1[ 2 ]
1991 << std::endl;
1992 }
1993 }
1994 // Simplify materials (very useful for blender).
1996 {
1997 Idx j = 0;
1998 for ( auto && c : diffuse_colors )
1999 if ( ! map_colors.count( c ) )
2000 map_colors[ c ] = j++;
2001 }
2002
2003 // Output materials
2004 bool has_material = ! diffuse_colors.empty();
2005 if ( has_material )
2006 for ( auto&& pair : map_colors )
2008 ( output_mtl, pair.second, ambient_color, pair.first, specular_color);
2009 else
2012 // Output faces
2013 for ( Idx i = 0; i < n; ++i )
2014 {
2015 output_obj << "usemtl material_" // << ( has_material ? i : 0 )
2016 << ( has_material ? map_colors[ diffuse_colors[ i ] ] : 0 )
2017 << std::endl;
2018 Idx b = 8*i+1;
2019 for ( Idx j = 0; j < 8; j += 2 )
2020 output_obj << "f " << (b+j) << " " << (b+j+1)
2021 << " " << (b+(j+3)%8) << " " << (b+(j+2)%8) << std::endl;
2022 output_obj << "f " << b << " " << (b+2)
2023 << " " << (b+4) << " " << (b+6) << std::endl;
2024 output_obj << "f " << (b+1) << " " << (b+7)
2025 << " " << (b+5) << " " << (b+3) << std::endl;
2026 }
2027 output_mtl.close();
2028 return output_obj.good();
2029 }

â—† selfDisplay()

template<typename TKSpace>
void DGtal::Shortcuts< TKSpace >::selfDisplay ( std::ostream & out) const
inline

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Definition at line 3338 of file Shortcuts.h.

3339 {
3340 out << "[Shortcuts]";
3341 }

The documentation for this class was generated from the following file: