DGtal  1.1.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions
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. More...
 
typedef KSpace::Space Space
 Digital space. More...
 
typedef Space::Integer Integer
 Integer numbers. More...
 
typedef Space::Point Point
 Point with integer coordinates. More...
 
typedef Space::Vector Vector
 Vector with integer coordinates. More...
 
typedef Space::RealVector RealVector
 Vector with floating-point coordinates. More...
 
typedef Space::RealPoint RealPoint
 Point with floating-point coordinates. More...
 
typedef RealVector::Component Scalar
 Floating-point numbers. More...
 
typedef HyperRectDomain< SpaceDomain
 An (hyper-)rectangular domain. More...
 
typedef unsigned char GrayScale
 The type for 8-bits gray-scale elements. More...
 
typedef MPolynomial< Space::dimension, ScalarScalarPolynomial
 defines a multi-variate polynomial : RealPoint -> Scalar More...
 
typedef ImplicitPolynomial3Shape< SpaceImplicitShape3D
 
typedef GaussDigitizer< Space, ImplicitShape3DDigitizedImplicitShape3D
 defines the digitization of an implicit shape. More...
 
typedef ImageContainerBySTLVector< Domain, bool > BinaryImage
 defines a black and white image with (hyper-)rectangular domain. More...
 
typedef ImageContainerBySTLVector< Domain, GrayScaleGrayScaleImage
 defines a grey-level image with (hyper-)rectangular domain. More...
 
typedef ImageContainerBySTLVector< Domain, float > FloatImage
 defines a float image with (hyper-)rectangular domain. More...
 
typedef ImageContainerBySTLVector< Domain, double > DoubleImage
 defines a double image with (hyper-)rectangular domain. More...
 
typedef KSpace::SurfelSet SurfelSet
 defines a set of surfels More...
 
typedef LightImplicitDigitalSurface< KSpace, BinaryImageLightSurfaceContainer
 
typedef ::DGtal::DigitalSurface< LightSurfaceContainerLightDigitalSurface
 defines a connected digital surface over a binary image. More...
 
typedef SetOfSurfels< KSpace, SurfelSetExplicitSurfaceContainer
 defines a heavy container that represents any digital surface. More...
 
typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainerDigitalSurface
 defines an arbitrary digital surface over a binary image. More...
 
typedef IndexedDigitalSurface< ExplicitSurfaceContainerIdxDigitalSurface
 defines a connected or not indexed digital surface. More...
 
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 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 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 >
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.

Definition at line 104 of file Shortcuts.h.

Member Typedef Documentation

◆ Arc

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

Definition at line 165 of file Shortcuts.h.

◆ ArcRange

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

Definition at line 167 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 141 of file Shortcuts.h.

◆ Cell

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

Definition at line 162 of file Shortcuts.h.

◆ Cell2Index

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

Definition at line 188 of file Shortcuts.h.

◆ CellRange

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

Definition at line 174 of file Shortcuts.h.

◆ Color

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

Definition at line 190 of file Shortcuts.h.

◆ ColorMap

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

Definition at line 192 of file Shortcuts.h.

◆ Colors

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

Definition at line 191 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 158 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 139 of file Shortcuts.h.

◆ Domain

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

An (hyper-)rectangular domain.

Definition at line 127 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 147 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 156 of file Shortcuts.h.

◆ Face

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

Definition at line 166 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 145 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 129 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 143 of file Shortcuts.h.

◆ Idx

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

Definition at line 181 of file Shortcuts.h.

◆ IdxArc

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

Definition at line 170 of file Shortcuts.h.

◆ IdxArcRange

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

Definition at line 171 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 160 of file Shortcuts.h.

◆ IdxRange

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

Definition at line 182 of file Shortcuts.h.

◆ IdxSurfel

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

Definition at line 168 of file Shortcuts.h.

◆ IdxSurfelRange

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

Definition at line 177 of file Shortcuts.h.

◆ IdxSurfelSet

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

Definition at line 172 of file Shortcuts.h.

◆ IdxVertex

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

Definition at line 169 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 137 of file Shortcuts.h.

◆ Integer

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

Integer numbers.

Definition at line 115 of file Shortcuts.h.

◆ KSpace

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

Digital cellular space.

Definition at line 111 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 154 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 152 of file Shortcuts.h.

◆ Mesh

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

Definition at line 184 of file Shortcuts.h.

◆ Point

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

Point with integer coordinates.

Definition at line 117 of file Shortcuts.h.

◆ PointelRange

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

Definition at line 175 of file Shortcuts.h.

◆ PolygonalSurface

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

Definition at line 186 of file Shortcuts.h.

◆ RealPoint

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

Point with floating-point coordinates.

Definition at line 123 of file Shortcuts.h.

◆ RealPoints

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

Definition at line 180 of file Shortcuts.h.

◆ RealVector

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

Vector with floating-point coordinates.

Definition at line 121 of file Shortcuts.h.

◆ RealVectors

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

Definition at line 179 of file Shortcuts.h.

◆ Scalar

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

Floating-point numbers.

Definition at line 125 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 134 of file Shortcuts.h.

◆ Scalars

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

Definition at line 178 of file Shortcuts.h.

◆ SCell

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

Definition at line 163 of file Shortcuts.h.

◆ SCellRange

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

Definition at line 173 of file Shortcuts.h.

◆ Space

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

Digital space.

Definition at line 113 of file Shortcuts.h.

◆ Surfel

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

Definition at line 161 of file Shortcuts.h.

◆ Surfel2Index

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

Definition at line 187 of file Shortcuts.h.

◆ SurfelRange

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

Definition at line 176 of file Shortcuts.h.

◆ SurfelSet

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

defines a set of surfels

Definition at line 149 of file Shortcuts.h.

◆ TriangulatedSurface

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

Definition at line 185 of file Shortcuts.h.

◆ Vector

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

Vector with integer coordinates.

Definition at line 119 of file Shortcuts.h.

◆ Vertex

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

Definition at line 164 of file Shortcuts.h.

◆ ZeroTickedColorMap

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

Definition at line 193 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 >
static Parameters DGtal::Shortcuts< TKSpace >::defaultParameters ( )
inlinestatic

◆ getCellEmbedder() [1/3]

template<typename TKSpace >
static CanonicCellEmbedder<KSpace> DGtal::Shortcuts< TKSpace >::getCellEmbedder ( const KSpace K)
inlinestatic

◆ getCellEmbedder() [2/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1009 of file Shortcuts.h.

1011  {
1012  return getCellEmbedder( refKSpace( surface ) );
1013  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder(), and DGtal::Shortcuts< TKSpace >::refKSpace().

◆ getCellEmbedder() [3/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1031 of file Shortcuts.h.

1033  {
1034  return getCellEmbedder( refKSpace( surface ) );
1035  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder(), and DGtal::Shortcuts< TKSpace >::refKSpace().

◆ getCellRange() [1/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1397 of file Shortcuts.h.

1401  {
1402  CellRange result;
1403  // Approximate number of pointels given the number of 2-cells (valid for 2d surfaces in nD).
1404  result.reserve( 2 * surface->size() + 100 );
1405  const KSpace& K = refKSpace( surface );
1406  Idx n = 0;
1407  for ( auto&& surfel : *surface )
1408  {
1409  CellRange primal_cells = getPrimalCells( K, surfel, k );
1410  for ( auto&& primal_cell : primal_cells )
1411  {
1412  if ( ! c2i.count( primal_cell ) )
1413  {
1414  result.push_back( primal_cell );
1415  c2i[ primal_cell ] = n++;
1416  }
1417  }
1418  }
1419  return result;
1420  }

References DGtal::Shortcuts< TKSpace >::getPrimalCells(), K, and DGtal::Shortcuts< TKSpace >::refKSpace().

Referenced by DGtal::Shortcuts< TKSpace >::getCellRange(), and main().

◆ getCellRange() [2/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1436 of file Shortcuts.h.

1440  {
1441  Cell2Index c2i;
1442  return getCellRange( c2i, surface, k );
1443  }

References DGtal::Shortcuts< TKSpace >::getCellRange().

◆ getColorMap()

template<typename TKSpace >
static 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 2619 of file Shortcuts.h.

2622  {
2623  std::string cmap = params[ "colormap" ].as<std::string>();
2624  if ( cmap == "Cool" ) return ColorMap( min, max, CMAP_COOL );
2625  else if ( cmap == "Copper" ) return ColorMap( min, max, CMAP_COPPER );
2626  else if ( cmap == "Hot" ) return ColorMap( min, max, CMAP_HOT );
2627  else if ( cmap == "Jet" ) return ColorMap( min, max, CMAP_JET );
2628  else if ( cmap == "Spring" ) return ColorMap( min, max, CMAP_SPRING );
2629  else if ( cmap == "Summer" ) return ColorMap( min, max, CMAP_SUMMER );
2630  else if ( cmap == "Autumn" ) return ColorMap( min, max, CMAP_AUTUMN );
2631  else if ( cmap == "Winter" ) return ColorMap( min, max, CMAP_WINTER );
2632  else if ( cmap == "Error" )
2633  {
2634  ColorMap gradcmap( min, max );
2635  gradcmap.addColor( Color( 255, 255, 255 ) );
2636  gradcmap.addColor( Color( 255, 0, 0 ) );
2637  gradcmap.addColor( Color( 0, 0, 0 ) );
2638  return gradcmap;
2639  }
2640  // Custom colormap
2641  ColorMap gradcmap( min, max );
2642  gradcmap.addColor( Color( 0, 0, 255 ) );
2643  gradcmap.addColor( Color( 0, 255, 255 ) );
2644  gradcmap.addColor( Color( 255, 255, 255 ) );
2645  gradcmap.addColor( Color( 255, 255, 0 ) );
2646  gradcmap.addColor( Color( 255, 0, 0 ) );
2647  return gradcmap;
2648  }

References DGtal::GradientColorMap< PValue, PDefaultPreset, PDefaultFirstColor, PDefaultLastColor >::addColor(), DGtal::CMAP_AUTUMN, DGtal::CMAP_COOL, DGtal::CMAP_COPPER, DGtal::CMAP_HOT, DGtal::CMAP_JET, DGtal::CMAP_SPRING, DGtal::CMAP_SUMMER, DGtal::CMAP_WINTER, and max().

Referenced by DGtal::Shortcuts< TKSpace >::getZeroTickedColorMap(), and main().

◆ getIdxSurfelRange() [1/2]

template<typename TKSpace >
static 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 1630 of file Shortcuts.h.

1634  {
1635  IdxSurfelRange result;
1636  std::string traversal = params[ "surfaceTraversal" ].as<std::string>();
1637  if ( traversal == "DepthFirst" )
1638  {
1639  typedef DepthFirstVisitor< IdxDigitalSurface > Visitor;
1640  typedef GraphVisitorRange< Visitor > VisitorRange;
1641  VisitorRange range( new Visitor( *surface, start_surfel ) );
1642  std::for_each( range.begin(), range.end(),
1643  [&result] ( IdxSurfel s ) { result.push_back( s ); } );
1644  }
1645  else if ( traversal == "BreadthFirst" )
1646  {
1647  typedef BreadthFirstVisitor< IdxDigitalSurface > Visitor;
1648  typedef GraphVisitorRange< Visitor > VisitorRange;
1649  VisitorRange range( new Visitor( *surface, start_surfel ) );
1650  std::for_each( range.begin(), range.end(),
1651  [&result] ( IdxSurfel s ) { result.push_back( s ); } );
1652  }
1653  else return surface->allVertices();
1654  return result;
1655  }

References DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer >::allVertices().

◆ getIdxSurfelRange() [2/2]

template<typename TKSpace >
static 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 1610 of file Shortcuts.h.

1613  {
1614  return getIdxSurfelRange( surface, (IdxSurfel) 0, params );
1615  }

Referenced by DGtal::Shortcuts< TKSpace >::makeDigitalSurface(), and DGtal::Shortcuts< TKSpace >::outputPrimalIdxDigitalSurfaceAsObj().

◆ getKSpace() [1/6]

template<typename TKSpace >
static 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 331 of file Shortcuts.h.

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

Referenced by DGtal::DigitalSurfaceRegularization< TDigitalSurface >::DigitalSurfaceRegularization(), main(), DGtal::Shortcuts< TKSpace >::makePolygonalSurface(), DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface(), SCENARIO(), and TEST_CASE().

◆ getKSpace() [2/6]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 395 of file Shortcuts.h.

397  {
398  return surface->container().space();
399  }

◆ getKSpace() [3/6]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 406 of file Shortcuts.h.

408  {
409  return surface->container().space();
410  }

◆ getKSpace() [4/6]

template<typename TKSpace >
static 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 353 of file Shortcuts.h.

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

◆ getKSpace() [5/6]

template<typename TKSpace >
static 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 377 of file Shortcuts.h.

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

◆ getKSpace() [6/6]

template<typename TKSpace >
static 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 485 of file Shortcuts.h.

487  {
488  Scalar min_x = params[ "minAABB" ].as<Scalar>();
489  Scalar max_x = params[ "maxAABB" ].as<Scalar>();
490  Scalar h = params[ "gridstep" ].as<Scalar>();
491  Scalar offset = params[ "offset" ].as<Scalar>();
492  bool closed = params[ "closed" ].as<int>();
493  RealPoint p1( min_x - offset * h, min_x - offset * h, min_x - offset * h );
494  RealPoint p2( max_x + offset * h, max_x + offset * h, max_x + offset * h );
495  CountedPtr<DigitizedImplicitShape3D> dshape( new DigitizedImplicitShape3D() );
496  dshape->init( p1, p2, h );
497  Domain domain = dshape->getDomain();
498  KSpace K;
499  if ( ! K.init( domain.lowerBound(), domain.upperBound(), closed ) )
500  trace.error() << "[Shortcuts::getKSpace]"
501  << " Error building Khalimsky space K=" << K << std::endl
502  << "Note: if you use decimal values, check your locale for decimal point '.' or ','."
503  << std::endl;
504  return K;
505  }

◆ getMatchedRange()

template<typename TKSpace >
template<typename TValue >
static 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 ] ].
Returns
the the corresponding reordered/rematched range.
See also
getRangeMatch

Definition at line 2604 of file Shortcuts.h.

2605  {
2606  std::vector< TValue > result( match.size() );
2607  for ( Idx i = 0; i < result.size(); i++ )
2608  result[ i ] = range[ match[ i ] ];
2609  return result;
2610  }

Referenced by main().

◆ getPointelRange() [1/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1467 of file Shortcuts.h.

1470  {
1471  PointelRange result;
1472  result.reserve( surface->size() );
1473  const KSpace& K = refKSpace( surface );
1474  Idx n = 0;
1475  for ( auto&& surfel : *surface )
1476  {
1477  CellRange primal_vtcs = getPointelRange( K, surfel );
1478  for ( auto&& primal_vtx : primal_vtcs )
1479  {
1480  if ( ! c2i.count( primal_vtx ) )
1481  {
1482  result.push_back( primal_vtx );
1483  c2i[ primal_vtx ] = n++;
1484  }
1485  }
1486  }
1487  return result;
1488  }

References K, and DGtal::Shortcuts< TKSpace >::refKSpace().

Referenced by DGtal::Shortcuts< TKSpace >::getPointelRange(), main(), DGtal::Shortcuts< TKSpace >::outputSurfelsAsObj(), DGtal::Shortcuts< TKSpace >::saveOBJ(), DGtal::Shortcuts< TKSpace >::saveOFF(), and SCENARIO().

◆ getPointelRange() [2/3]

template<typename TKSpace >
static 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 1524 of file Shortcuts.h.

1526  {
1527  return KSpace::dimension == 3
1528  ? getPrimalVertices( K, surfel, true )
1529  : getPrimalVertices( K, surfel );
1530  }

References DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::Shortcuts< TKSpace >::getPrimalVertices(), and K.

◆ getPointelRange() [3/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1508 of file Shortcuts.h.

1510  {
1511  Cell2Index c2i;
1512  return getPointelRange( c2i, surface );
1513  }

References DGtal::Shortcuts< TKSpace >::getPointelRange().

◆ getPolynomialList()

template<typename TKSpace >
static 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 235 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::makeImplicitShape3D().

◆ getPrimalCells()

template<typename TKSpace >
static 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 3115 of file Shortcuts.h.

3116  {
3117  auto faces = K.uFaces( K.unsigns( s ) );
3118  CellRange primal_cells;
3119  for ( auto&& f : faces )
3120  {
3121  if ( K.uDim( f ) == k ) primal_cells.push_back( f );
3122  }
3123  return primal_cells;
3124  }

References K, DGtal::KhalimskySpaceND< dim, TInteger >::uDim(), DGtal::KhalimskySpaceND< dim, TInteger >::uFaces(), and DGtal::KhalimskySpaceND< dim, TInteger >::unsigns().

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

◆ getPrimalVertices() [1/2]

template<typename TKSpace >
static 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 3131 of file Shortcuts.h.

3132  {
3133  return getPrimalCells( K, s, 0 );
3134  }

References DGtal::Shortcuts< TKSpace >::getPrimalCells(), and K.

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

◆ getPrimalVertices() [2/2]

template<typename TKSpace >
static 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 3143 of file Shortcuts.h.

3144  {
3145  BOOST_STATIC_ASSERT(( KSpace::dimension == 3 ));
3146  CellRange vtcs = getPrimalVertices( K, s );
3147  std::swap( vtcs[ 2 ], vtcs[ 3 ] );
3148  auto orth_dir = K.sOrthDir( s );
3149  auto direct = K.sDirect( s, orth_dir ) ? ccw : ! ccw;
3150  Vector s0s1 = K.uCoords( vtcs[ 1 ] ) - K.uCoords( vtcs[ 0 ] );
3151  Vector s0s2 = K.uCoords( vtcs[ 2 ] ) - K.uCoords( vtcs[ 0 ] );
3152  Vector t = s0s1.crossProduct( s0s2 );
3153  if ( ( ( t[ orth_dir ] > 0.0 ) && direct )
3154  || ( ( t[ orth_dir ] < 0.0 ) && ! direct ) )
3155  std::reverse( vtcs.begin(), vtcs.end() );
3156  return vtcs;
3157  }

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::crossProduct(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::Shortcuts< TKSpace >::getPrimalVertices(), K, reverse(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirect(), DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDir(), and DGtal::KhalimskySpaceND< dim, TInteger >::uCoords().

◆ getRangeMatch()

template<typename TKSpace >
template<typename TValue >
static 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 ] ].

Template Parameters
TValuea model of boost::Assignable, boost::CopyConstructible, boost::LessThanComparable
Parameters
[in]s1a range of values
[in]s2another range of values which contains the same values as s1 but in any order.
[in]perfectif 'true' ask for a perfect match, otherwise extracts correspondences.
Returns
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 2569 of file Shortcuts.h.

2571  {
2572  if ( perfect && ( s1.size() != s2.size() ) ) return IdxRange();
2573  std::map<TValue, Idx> M;
2574  Idx idx = 0;
2575  for ( auto val : s2 ) M[ val ] = idx++;
2576  IdxRange V( s1.size() );
2577  idx = 0;
2578  for ( auto val : s1 )
2579  {
2580  auto it = M.find( val );
2581  if ( it != M.end() ) V[ idx++ ] = it->second;
2582  else
2583  {
2584  if ( perfect ) return IdxRange();
2585  V[ idx++ ] = s2.size();
2586  }
2587  }
2588  return V;
2589  }

Referenced by main().

◆ getSCellEmbedder() [1/3]

template<typename TKSpace >
static 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 445 of file Shortcuts.h.

446  {
447  return CanonicSCellEmbedder<KSpace>( K );
448  }

References K.

Referenced by DGtal::Shortcuts< TKSpace >::getSCellEmbedder(), and main().

◆ getSCellEmbedder() [2/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1020 of file Shortcuts.h.

1022  {
1023  return getSCellEmbedder( refKSpace( surface ) );
1024  }

References DGtal::Shortcuts< TKSpace >::getSCellEmbedder(), and DGtal::Shortcuts< TKSpace >::refKSpace().

◆ getSCellEmbedder() [3/3]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1042 of file Shortcuts.h.

1044  {
1045  return getSCellEmbedder( refKSpace( surface ) );
1046  }

References DGtal::Shortcuts< TKSpace >::getSCellEmbedder(), and DGtal::Shortcuts< TKSpace >::refKSpace().

◆ getSurfelRange() [1/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1545 of file Shortcuts.h.

1548  {
1549  return getSurfelRange( surface, *( surface->begin() ), params );
1550  }

Referenced by main(), DGtal::Shortcuts< TKSpace >::outputPrimalDigitalSurfaceAsObj(), and TEST_CASE().

◆ getSurfelRange() [2/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1568 of file Shortcuts.h.

1572  {
1573  typedef ::DGtal::DigitalSurface<TDigitalSurfaceContainer> AnyDigitalSurface;
1574  SurfelRange result;
1575  std::string traversal = params[ "surfaceTraversal" ].as<std::string>();
1576  if ( traversal == "DepthFirst" )
1577  {
1578  typedef DepthFirstVisitor< AnyDigitalSurface > Visitor;
1579  typedef GraphVisitorRange< Visitor > VisitorRange;
1580  VisitorRange range( new Visitor( *surface, start_surfel ) );
1581  std::for_each( range.begin(), range.end(),
1582  [&result] ( Surfel s ) { result.push_back( s ); } );
1583  }
1584  else if ( traversal == "BreadthFirst" )
1585  {
1586  typedef BreadthFirstVisitor< AnyDigitalSurface > Visitor;
1587  typedef GraphVisitorRange< Visitor > VisitorRange;
1588  VisitorRange range( new Visitor( *surface, start_surfel ) );
1589  std::for_each( range.begin(), range.end(),
1590  [&result] ( Surfel s ) { result.push_back( s ); } );
1591  }
1592  else
1593  {
1594  std::for_each( surface->begin(), surface->end(),
1595  [&result] ( Surfel s ) { result.push_back( s ); } );
1596  }
1597  return result;
1598  }

◆ getZeroTickedColorMap()

template<typename TKSpace >
static 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 2657 of file Shortcuts.h.

2660  {
2661  auto cmap = getColorMap( min, max, params );
2662  auto ztic = params[ "zero-tic" ].as<double>();
2663  ZeroTickedColorMap ztic_cmap( cmap, Color::Black );
2664  if ( ztic <= 0.0 ) return ztic_cmap;
2665  if ( min <= 0.0 && 0.0 <= max )
2666  ztic_cmap.addTick( 0.0, ztic );
2667  ztic_cmap.finalize();
2668  return ztic_cmap;
2669  }

References DGtal::Color::Black, DGtal::Shortcuts< TKSpace >::getColorMap(), and max().

◆ 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 3215 of file Shortcuts.h.

3216  {
3217  return true;
3218  }

◆ makeBinaryImage() [1/6]

template<typename TKSpace >
static 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 627 of file Shortcuts.h.

629  {
630  const Scalar noise = params[ "noise" ].as<Scalar>();
631  if ( noise <= 0.0 ) return bimage;
632  typedef KanungoNoise< BinaryImage, Domain > KanungoPredicate;
633  const Domain shapeDomain = bimage->domain();
634  CountedPtr<BinaryImage> img ( new BinaryImage( shapeDomain ) );
635  KanungoPredicate noisy_dshape( *bimage, shapeDomain, noise );
636  std::transform( shapeDomain.begin(), shapeDomain.end(),
637  img->begin(),
638  [&noisy_dshape] ( const Point& p ) { return noisy_dshape(p); } );
639  return img;
640  }

References DGtal::HyperRectDomain< TSpace >::begin(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), and DGtal::HyperRectDomain< TSpace >::end().

◆ makeBinaryImage() [2/6]

template<typename TKSpace >
static 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 595 of file Shortcuts.h.

598  {
599  const Scalar noise = params[ "noise" ].as<Scalar>();
600  CountedPtr<BinaryImage> img ( new BinaryImage( shapeDomain ) );
601  if ( noise <= 0.0 )
602  {
603  std::transform( shapeDomain.begin(), shapeDomain.end(),
604  img->begin(),
605  [&shape_digitization]
606  ( const Point& p ) { return (*shape_digitization)(p); } );
607  }
608  else
609  {
610  typedef KanungoNoise< DigitizedImplicitShape3D, Domain > KanungoPredicate;
611  KanungoPredicate noisy_dshape( *shape_digitization, shapeDomain, noise );
612  std::transform( shapeDomain.begin(), shapeDomain.end(),
613  img->begin(),
614  [&noisy_dshape] ( const Point& p ) { return noisy_dshape(p); } );
615  }
616  return img;
617  }

References DGtal::HyperRectDomain< TSpace >::begin(), and DGtal::HyperRectDomain< TSpace >::end().

◆ makeBinaryImage() [3/6]

template<typename TKSpace >
static 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 575 of file Shortcuts.h.

577  {
578  return makeBinaryImage( shape_digitization,
579  shape_digitization->getDomain(),
580  params );
581  }

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getDomain(), and DGtal::Shortcuts< TKSpace >::makeBinaryImage().

◆ makeBinaryImage() [4/6]

template<typename TKSpace >
static 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 683 of file Shortcuts.h.

686  {
687  int thresholdMin = params["thresholdMin"].as<int>();
688  int thresholdMax = params["thresholdMax"].as<int>();
689  Domain domain = gray_scale_image->domain();
690  typedef functors::IntervalForegroundPredicate<GrayScaleImage> ThresholdedImage;
691  ThresholdedImage tImage( *gray_scale_image, thresholdMin, thresholdMax );
692  CountedPtr<BinaryImage> img ( new BinaryImage( domain ) );
693  std::transform( domain.begin(), domain.end(),
694  img->begin(),
695  [tImage] ( const Point& p ) { return tImage(p); } );
696  return makeBinaryImage( img, params );
697  }

References DGtal::HyperRectDomain< TSpace >::begin(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), domain, DGtal::HyperRectDomain< TSpace >::end(), and DGtal::Shortcuts< TKSpace >::makeBinaryImage().

◆ makeBinaryImage() [5/6]

template<typename TKSpace >
static 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 560 of file Shortcuts.h.

561  {
562  return CountedPtr<BinaryImage>( new BinaryImage( shapeDomain ) );
563  }

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeBinaryImage(), DGtal::Shortcuts< TKSpace >::makePolygonalSurface(), DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface(), SCENARIO(), and TEST_CASE().

◆ makeBinaryImage() [6/6]

template<typename TKSpace >
static 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 654 of file Shortcuts.h.

657  {
658  int thresholdMin = params["thresholdMin"].as<int>();
659  int thresholdMax = params["thresholdMax"].as<int>();
661  Domain domain = image.domain();
662  typedef functors::IntervalForegroundPredicate<GrayScaleImage> ThresholdedImage;
663  ThresholdedImage tImage( image, thresholdMin, thresholdMax );
664  CountedPtr<BinaryImage> img ( new BinaryImage( domain ) );
665  std::transform( domain.begin(), domain.end(),
666  img->begin(),
667  [tImage] ( const Point& p ) { return tImage(p); } );
668  return makeBinaryImage( img, params );
669  }

References DGtal::HyperRectDomain< TSpace >::begin(), domain, DGtal::HyperRectDomain< TSpace >::end(), DGtal::GenericReader< TContainer, Tdim, TValue >::import(), and DGtal::Shortcuts< TKSpace >::makeBinaryImage().

◆ makeDigitalSurface() [1/2]

template<typename TKSpace >
static 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 1238 of file Shortcuts.h.

1241  {
1242  bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1243  const KSpace& K = refKSpace( idx_surface );
1244  SurfelAdjacency< KSpace::dimension > surfAdj( surfel_adjacency );
1245  auto all_idx_surfels
1246  = getIdxSurfelRange( idx_surface, Parameters( "surfaceTraversal", "Default" ) );
1247  auto idx2surfel = idx_surface->surfels();
1248  SurfelSet all_surfels;
1249  for ( auto idx : all_idx_surfels ) all_surfels.insert( idx2surfel[ idx ] );
1250  ExplicitSurfaceContainer* surfContainer
1251  = new ExplicitSurfaceContainer( K, surfAdj, all_surfels );
1252  return CountedPtr<DigitalSurface>
1253  ( new DigitalSurface( surfContainer ) ); // acquired
1254  }

References DGtal::Shortcuts< TKSpace >::getIdxSurfelRange(), K, DGtal::Shortcuts< TKSpace >::refKSpace(), and DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer >::surfels().

◆ makeDigitalSurface() [2/2]

template<typename TKSpace >
template<typename TPointPredicate >
static 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 1207 of file Shortcuts.h.

1211  {
1212  SurfelSet all_surfels;
1213  bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1214  SurfelAdjacency< KSpace::dimension > surfAdj( surfel_adjacency );
1215  // Extracts all boundary surfels
1216  Surfaces<KSpace>::sMakeBoundary( all_surfels, K, *bimage,
1217  K.lowerBound(), K.upperBound() );
1218  ExplicitSurfaceContainer* surfContainer
1219  = new ExplicitSurfaceContainer( K, surfAdj, all_surfels );
1220  return CountedPtr< DigitalSurface >
1221  ( new DigitalSurface( surfContainer ) ); // acquired
1222  }

References K, DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Surfaces< TKSpace >::sMakeBoundary(), and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().

Referenced by main(), DGtal::Shortcuts< TKSpace >::makePolygonalSurface(), DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface(), DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface(), and TEST_CASE().

◆ makeDigitizedImplicitShape3D()

template<typename TKSpace >
static 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 521 of file Shortcuts.h.

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

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), and DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init().

Referenced by main(), SCENARIO(), and TEST_CASE().

◆ makeDoubleImage() [1/3]

template<typename TKSpace >
static 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 962 of file Shortcuts.h.

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

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), domain, DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getDomain(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init(), and DGtal::Shortcuts< TKSpace >::makeDoubleImage().

◆ makeDoubleImage() [2/3]

template<typename TKSpace >
static 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 929 of file Shortcuts.h.

930  {
931  return CountedPtr<DoubleImage>( new DoubleImage( aDomain ) );
932  }

Referenced by DGtal::Shortcuts< TKSpace >::makeDoubleImage().

◆ makeDoubleImage() [3/3]

template<typename TKSpace >
static 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 941 of file Shortcuts.h.

943  {
945  return CountedPtr<DoubleImage>( new DoubleImage( image ) );
946  }

References DGtal::GenericReader< TContainer, Tdim, TValue >::import().

◆ makeDualPolygonalSurface() [1/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2287 of file Shortcuts.h.

2288  {
2289  Surfel2Index s2i;
2290  return makeDualPolygonalSurface( s2i, aSurface );
2291  }

References DGtal::Shortcuts< TKSpace >::makeDualPolygonalSurface().

◆ makeDualPolygonalSurface() [2/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2301 of file Shortcuts.h.

2303  {
2304  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
2305  auto pPolySurf = CountedPtr<PolygonalSurface>
2306  ( new PolygonalSurface( aSurface->heds(),
2307  aSurface->positions().storage() ) );
2308  return pPolySurf;
2309  }

References DGtal::KhalimskySpaceND< dim, TInteger >::dimension.

◆ makeDualPolygonalSurface() [3/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2267 of file Shortcuts.h.

2269  {
2270  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
2271  auto embedder = getCellEmbedder( aSurface );
2272  auto pPolySurf = CountedPtr<PolygonalSurface>
2273  ( new PolygonalSurface ); // acquired
2275  ( *aSurface, embedder, *pPolySurf, s2i );
2276  return pPolySurf;
2277  }

References DGtal::MeshHelpers::digitalSurface2DualPolygonalSurface(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, and DGtal::Shortcuts< TKSpace >::getCellEmbedder().

Referenced by DGtal::Shortcuts< TKSpace >::makeDualPolygonalSurface(), and TEST_CASE().

◆ makeFloatImage() [1/3]

template<typename TKSpace >
static 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 896 of file Shortcuts.h.

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

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), domain, DGtal::GaussDigitizer< TSpace, TEuclideanShape >::getDomain(), DGtal::GaussDigitizer< TSpace, TEuclideanShape >::init(), and DGtal::Shortcuts< TKSpace >::makeFloatImage().

◆ makeFloatImage() [2/3]

template<typename TKSpace >
static 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 863 of file Shortcuts.h.

864  {
865  return CountedPtr<FloatImage>( new FloatImage( aDomain ) );
866  }

Referenced by DGtal::Shortcuts< TKSpace >::makeFloatImage().

◆ makeFloatImage() [3/3]

template<typename TKSpace >
static 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 875 of file Shortcuts.h.

877  {
879  return CountedPtr<FloatImage>( new FloatImage( image ) );
880  }

References DGtal::GenericReader< TContainer, Tdim, TValue >::import().

◆ makeGrayScaleImage() [1/5]

template<typename TKSpace >
static 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 761 of file Shortcuts.h.

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

◆ makeGrayScaleImage() [2/5]

template<typename TKSpace >
static 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 834 of file Shortcuts.h.

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

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), domain, DGtal::Shortcuts< TKSpace >::makeGrayScaleImage(), and max().

◆ makeGrayScaleImage() [3/5]

template<typename TKSpace >
static 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 802 of file Shortcuts.h.

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

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), domain, DGtal::Shortcuts< TKSpace >::makeGrayScaleImage(), and max().

◆ makeGrayScaleImage() [4/5]

template<typename TKSpace >
static 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 735 of file Shortcuts.h.

736  {
737  return CountedPtr<GrayScaleImage>( new GrayScaleImage( aDomain ) );
738  }

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeGrayScaleImage(), and DGtal::Shortcuts< TKSpace >::saveBinaryImage().

◆ makeGrayScaleImage() [5/5]

template<typename TKSpace >
static 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 747 of file Shortcuts.h.

749  {
751  return CountedPtr<GrayScaleImage>( new GrayScaleImage( image ) );
752  }

References DGtal::GenericReader< TContainer, Tdim, TValue >::import().

◆ makeIdxDigitalSurface() [1/4]

template<typename TKSpace >
static 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 1362 of file Shortcuts.h.

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

References K, DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), DGtal::trace, DGtal::KhalimskySpaceND< dim, TInteger >::upperBound(), and DGtal::Trace::warning().

◆ makeIdxDigitalSurface() [2/4]

template<typename TKSpace >
template<typename TSurfelRange >
static 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 1306 of file Shortcuts.h.

1310  {
1311  bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1312  SurfelAdjacency< KSpace::dimension > surfAdj( surfel_adjacency );
1313  // Build indexed digital surface.
1314  CountedPtr<ExplicitSurfaceContainer> ptrSurfContainer
1315  ( new ExplicitSurfaceContainer( K, surfAdj, surfels ) );
1316  CountedPtr<IdxDigitalSurface> ptrSurface
1317  ( new IdxDigitalSurface() );
1318  bool ok = ptrSurface->build( ptrSurfContainer );
1319  if ( !ok )
1320  trace.warning() << "[Shortcuts::makeIdxDigitalSurface]"
1321  << " Error building indexed digital surface." << std::endl;
1322  return ptrSurface;
1323  }

References DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer >::build(), K, DGtal::trace, and DGtal::Trace::warning().

◆ makeIdxDigitalSurface() [3/4]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1339 of file Shortcuts.h.

1342  {
1343  const KSpace& K = refKSpace( surface );
1344  SurfelSet surfels;
1345  surfels.insert( surface->begin(), surface->end() );
1346  return makeIdxDigitalSurface( surfels, K, params );
1347  }

References K, DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), and DGtal::Shortcuts< TKSpace >::refKSpace().

◆ makeIdxDigitalSurface() [4/4]

template<typename TKSpace >
static 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 1273 of file Shortcuts.h.

1277  {
1278  std::string component = params[ "surfaceComponents" ].as<std::string>();
1279  SurfelSet surfels;
1280  if ( component == "AnyBig" )
1281  {
1282  auto light_surface = makeLightDigitalSurface( bimage, K, params );
1283  surfels.insert( light_surface->begin(), light_surface->end() );
1284  }
1285  else if ( component == "All" )
1286  {
1287  Surfaces<KSpace>::sMakeBoundary( surfels, K, *bimage,
1288  K.lowerBound(), K.upperBound() );
1289  }
1290  return makeIdxDigitalSurface( surfels, K, params );
1291  }

References K, DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface(), DGtal::Surfaces< TKSpace >::sMakeBoundary(), and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), and TEST_CASE().

◆ makeImplicitShape3D()

template<typename TKSpace >
static 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 281 of file Shortcuts.h.

282  {
283  typedef MPolynomialReader< Space::dimension, Scalar> Polynomial3Reader;
284  std::string poly_str = params[ "polynomial" ].as<std::string>();
285  // Recognizes specific strings as polynomials.
286  auto PL = getPolynomialList();
287  if ( PL[ poly_str ] != "" ) poly_str = PL[ poly_str ];
288  ScalarPolynomial poly;
289  Polynomial3Reader reader;
290  std::string::const_iterator iter
291  = reader.read( poly, poly_str.begin(), poly_str.end() );
292  if ( iter != poly_str.end() )
293  {
294  trace.error() << "[Shortcuts::makeImplicitShape3D]"
295  << " ERROR reading polynomial: I read only <"
296  << poly_str.substr( 0, iter - poly_str.begin() )
297  << ">, and I built P=" << poly << std::endl;
298  }
299  return CountedPtr<ImplicitShape3D>( new ImplicitShape3D( poly ) );
300  }

References DGtal::Trace::error(), DGtal::Shortcuts< TKSpace >::getPolynomialList(), DGtal::MPolynomialReader< n, TRing, TAlloc, TIterator >::read(), and DGtal::trace.

Referenced by main(), SCENARIO(), and TEST_CASE().

◆ makeLightDigitalSurface()

template<typename TKSpace >
static 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 1060 of file Shortcuts.h.

1064  {
1065  bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1066  int nb_tries_to_find_a_bel = params[ "nbTriesToFindABel" ].as<int>();
1067  SurfelAdjacency< KSpace::dimension > surfAdj( surfel_adjacency );
1068 
1069  // We have to search for a surfel that belongs to a big connected component.
1070  CountedPtr<LightDigitalSurface> ptrSurface;
1071  Surfel bel;
1072  Scalar minsize = bimage->extent().norm();
1073  unsigned int nb_surfels = 0;
1074  unsigned int tries = 0;
1075  do
1076  {
1077  try { // Search initial bel
1078  bel = Surfaces<KSpace>::findABel( K, *bimage, nb_tries_to_find_a_bel );
1079  } catch (DGtal::InputException& e) {
1080  trace.error() << "[Shortcuts::makeLightDigitalSurface]"
1081  << " ERROR Unable to find bel. " << e << std::endl;
1082  return ptrSurface;
1083  }
1084  // this pointer will be acquired by the surface.
1085  LightSurfaceContainer* surfContainer
1086  = new LightSurfaceContainer( K, *bimage, surfAdj, bel );
1087  ptrSurface = CountedPtr<LightDigitalSurface>
1088  ( new LightDigitalSurface( surfContainer ) ); // acquired
1089  nb_surfels = ptrSurface->size();
1090  }
1091  while ( ( nb_surfels < 2 * minsize ) && ( tries++ < 150 ) );
1092  if( tries >= 150 )
1093  trace.warning() << "[Shortcuts::makeLightDigitalSurface]"
1094  << "ERROR cannot find a proper bel in a big enough component."
1095  << std::endl;
1096  return ptrSurface;
1097  }

References DGtal::Trace::error(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::extent(), DGtal::Surfaces< TKSpace >::findABel(), K, DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm(), DGtal::DigitalSurface< TDigitalSurfaceContainer >::size(), DGtal::trace, and DGtal::Trace::warning().

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurfaces(), SCENARIO(), and TEST_CASE().

◆ makeLightDigitalSurfaces() [1/2]

template<typename TKSpace >
static 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 1117 of file Shortcuts.h.

1121  {
1122  SurfelRange surfel_reps;
1123  return makeLightDigitalSurfaces( surfel_reps, bimage, K, params );
1124  }

References K.

Referenced by main().

◆ makeLightDigitalSurfaces() [2/2]

template<typename TKSpace >
static 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 1147 of file Shortcuts.h.

1152  {
1153  std::vector< CountedPtr<LightDigitalSurface> > result;
1154  std::string component = params[ "surfaceComponents" ].as<std::string>();
1155  if ( component == "AnyBig" )
1156  {
1157  result.push_back( makeLightDigitalSurface( bimage, K, params ) );
1158  surfel_reps.push_back( *( result[ 0 ]->begin() ) );
1159  return result;
1160  }
1161  bool surfel_adjacency = params[ "surfelAdjacency" ].as<int>();
1162  SurfelAdjacency< KSpace::dimension > surfAdj( surfel_adjacency );
1163  // Extracts all boundary surfels
1164  SurfelSet all_surfels;
1165  Surfaces<KSpace>::sMakeBoundary( all_surfels, K, *bimage,
1166  K.lowerBound(), K.upperBound() );
1167  // Builds all connected components of surfels.
1168  SurfelSet marked_surfels;
1169  CountedPtr<LightDigitalSurface> ptrSurface;
1170  for ( auto bel : all_surfels )
1171  {
1172  if ( marked_surfels.count( bel ) != 0 ) continue;
1173  surfel_reps.push_back( bel );
1174  LightSurfaceContainer* surfContainer
1175  = new LightSurfaceContainer( K, *bimage, surfAdj, bel );
1176  ptrSurface = CountedPtr<LightDigitalSurface>
1177  ( new LightDigitalSurface( surfContainer ) ); // acquired
1178  // mark all surfels of the surface component.
1179  marked_surfels.insert( ptrSurface->begin(), ptrSurface->end() );
1180  // add surface component to result.
1181  result.push_back( ptrSurface );
1182  }
1183  return result;
1184  }

References DGtal::DigitalSurface< TDigitalSurfaceContainer >::begin(), DGtal::DigitalSurface< TDigitalSurfaceContainer >::end(), K, DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface(), DGtal::Surfaces< TKSpace >::sMakeBoundary(), and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().

◆ makeMesh() [1/2]

template<typename TKSpace >
static 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 2087 of file Shortcuts.h.

2089  {
2090  auto pMesh = CountedPtr<Mesh>( new Mesh( aColor ) ); // acquired
2091  MeshHelpers::polygonalSurface2Mesh( *polySurf, *pMesh );
2092  return pMesh;
2093  }

References DGtal::MeshHelpers::polygonalSurface2Mesh().

◆ makeMesh() [2/2]

template<typename TKSpace >
static 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 2070 of file Shortcuts.h.

2072  {
2073  auto pMesh = CountedPtr<Mesh>( new Mesh( aColor ) ); // acquired
2074  MeshHelpers::triangulatedSurface2Mesh( *triSurf, *pMesh );
2075  return pMesh;
2076  }

References DGtal::MeshHelpers::triangulatedSurface2Mesh().

Referenced by main().

◆ makePolygonalSurface() [1/2]

template<typename TKSpace >
static 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 2187 of file Shortcuts.h.

2192  {
2193  auto K = getKSpace( gray_scale_image );
2194  auto bimage = makeBinaryImage( gray_scale_image, params );
2195  auto digSurf = makeDigitalSurface( bimage, K, params );
2196  RealVector gh = { params[ "gridsizex" ].as<double>(),
2197  params[ "gridsizey" ].as<double>(),
2198  params[ "gridsizez" ].as<double>() };
2199  double threshold = params[ "thresholdMin" ].as<double>() + 0.5;
2200  typedef RegularPointEmbedder<Space> PointEmbedder;
2201  typedef ImageLinearCellEmbedder
2202  < KSpace, GrayScaleImage, PointEmbedder > ImageCellEmbedder;
2203  PointEmbedder pembedder;
2204  pembedder.init( gh );
2205  ImageCellEmbedder cembedder;
2206  cembedder.init( K, *gray_scale_image, pembedder, threshold );
2207  auto pPolySurf = CountedPtr<PolygonalSurface>
2208  ( new PolygonalSurface ); // acquired
2209  Surfel2Index s2i;
2211  ( *digSurf, cembedder, *pPolySurf, s2i );
2212  return pPolySurf;
2213  }

References DGtal::MeshHelpers::digitalSurface2DualPolygonalSurface(), DGtal::Shortcuts< TKSpace >::getKSpace(), K, DGtal::Shortcuts< TKSpace >::makeBinaryImage(), and DGtal::Shortcuts< TKSpace >::makeDigitalSurface().

◆ makePolygonalSurface() [2/2]

template<typename TKSpace >
static 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 2165 of file Shortcuts.h.

2166  {
2167  auto pPolySurf = CountedPtr<PolygonalSurface>
2168  ( new PolygonalSurface ); // acquired
2169  bool ok = MeshHelpers::mesh2PolygonalSurface( *aMesh, *pPolySurf );
2170  return ok ? pPolySurf : CountedPtr< PolygonalSurface >( nullptr );
2171  }

References DGtal::MeshHelpers::mesh2PolygonalSurface().

◆ makePrimalPolygonalSurface() [1/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2320 of file Shortcuts.h.

2322  {
2323  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
2324  auto embedder = getCellEmbedder( aSurface );
2325  auto pPolySurf = CountedPtr<PolygonalSurface>
2326  ( new PolygonalSurface ); // acquired
2328  ( *aSurface, embedder, *pPolySurf, c2i );
2329  return ok ? pPolySurf : CountedPtr< PolygonalSurface >( nullptr );
2330  }

References DGtal::MeshHelpers::digitalSurface2PrimalPolygonalSurface(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, and DGtal::Shortcuts< TKSpace >::getCellEmbedder().

Referenced by DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface(), and SCENARIO().

◆ makePrimalPolygonalSurface() [2/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2340 of file Shortcuts.h.

2341  {
2342  Cell2Index c2i;
2343  return makePrimalPolygonalSurface( c2i, aSurface );
2344  }

References DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface().

◆ makePrimalPolygonalSurface() [3/3]

template<typename TKSpace >
template<typename TContainer >
static 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 2354 of file Shortcuts.h.

2356  {
2357  auto dsurf = makeDigitalSurface( aSurface );
2358  Cell2Index c2i;
2359  return makePrimalPolygonalSurface( c2i, dsurf );
2360  }

References DGtal::Shortcuts< TKSpace >::makeDigitalSurface(), and DGtal::Shortcuts< TKSpace >::makePrimalPolygonalSurface().

◆ makeTriangulatedSurface() [1/5]

template<typename TKSpace >
template<typename TContainer >
static 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 2121 of file Shortcuts.h.

2122  {
2123  Surfel2Index s2i;
2124  return makeTriangulatedSurface( s2i, aSurface );
2125  }

References DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface().

◆ makeTriangulatedSurface() [2/5]

template<typename TKSpace >
static 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 2230 of file Shortcuts.h.

2235  {
2236  auto K = getKSpace( gray_scale_image );
2237  auto bimage = makeBinaryImage( gray_scale_image, params );
2238  auto digSurf = makeDigitalSurface( bimage, K, params );
2239  RealVector gh = { params[ "gridsizex" ].as<double>(),
2240  params[ "gridsizey" ].as<double>(),
2241  params[ "gridsizez" ].as<double>() };
2242  double threshold = params[ "thresholdMin" ].as<double>() + 0.5;
2243  typedef RegularPointEmbedder<Space> PointEmbedder;
2244  typedef ImageLinearCellEmbedder
2245  < KSpace, GrayScaleImage, PointEmbedder > ImageCellEmbedder;
2246  PointEmbedder pembedder;
2247  pembedder.init( gh );
2248  ImageCellEmbedder cembedder;
2249  cembedder.init( K, *gray_scale_image, pembedder, threshold );
2250  auto pPolySurf = CountedPtr<TriangulatedSurface>
2251  ( new TriangulatedSurface ); // acquired
2252  Surfel2Index s2i;
2254  ( *digSurf, cembedder, *pPolySurf, s2i );
2255  return pPolySurf;
2256  }

References DGtal::MeshHelpers::digitalSurface2DualTriangulatedSurface(), DGtal::Shortcuts< TKSpace >::getKSpace(), K, DGtal::Shortcuts< TKSpace >::makeBinaryImage(), and DGtal::Shortcuts< TKSpace >::makeDigitalSurface().

◆ makeTriangulatedSurface() [3/5]

template<typename TKSpace >
static 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 2053 of file Shortcuts.h.

2054  {
2055  auto pTriSurf = CountedPtr<TriangulatedSurface>
2056  ( new TriangulatedSurface ); // acquired
2057  bool ok = MeshHelpers::mesh2TriangulatedSurface( *aMesh, *pTriSurf );
2058  return ok ? pTriSurf : CountedPtr< TriangulatedSurface >( nullptr );
2059  }

References DGtal::MeshHelpers::mesh2TriangulatedSurface().

Referenced by main(), and DGtal::Shortcuts< TKSpace >::makeTriangulatedSurface().

◆ makeTriangulatedSurface() [4/5]

template<typename TKSpace >
static 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 2145 of file Shortcuts.h.

2147  {
2148  std::string faceSubdivision = params[ "faceSubdivision" ].as<std::string>();
2149  bool centroid = ( faceSubdivision == "Centroid" );
2150  auto pTriSurf = CountedPtr<TriangulatedSurface>
2151  ( new TriangulatedSurface ); // acquired
2152  MeshHelpers::polygonalSurface2TriangulatedSurface( *polySurf, *pTriSurf, centroid );
2153  return pTriSurf;
2154  }

References DGtal::MeshHelpers::polygonalSurface2TriangulatedSurface().

◆ makeTriangulatedSurface() [5/5]

template<typename TKSpace >
template<typename TContainer >
static 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 2103 of file Shortcuts.h.

2105  {
2106  auto embedder = getCellEmbedder( aSurface );
2107  auto pTriSurf = CountedPtr<TriangulatedSurface>
2108  ( new TriangulatedSurface ); // acquired
2110  ( *aSurface, embedder, *pTriSurf, s2i );
2111  return pTriSurf;
2112  }

References DGtal::MeshHelpers::digitalSurface2DualTriangulatedSurface(), and DGtal::Shortcuts< TKSpace >::getCellEmbedder().

◆ 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 >
static bool DGtal::Shortcuts< TKSpace >::outputCellMapAsCSV ( std::ostream &  output,
const KSpace K,
const TCellMap &  anyMap,
const TValueWriter &  writer 
)
inlinestatic

Definition at line 3093 of file Shortcuts.h.

3098  {
3099  CellWriter w;
3100  for ( auto&& v : anyMap )
3101  {
3102  w( output, K, v.first );
3103  writer( output, v.second );
3104  output << std::endl;
3105  }
3106  return output.good();
3107  }

References K.

◆ outputDualDigitalSurfaceAsObj() [1/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 2833 of file Shortcuts.h.

2837  {
2838  auto embedder = getCellEmbedder( surface );
2839  return outputDualDigitalSurfaceAsObj( output, surface, embedder, params );
2840  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder().

◆ outputDualDigitalSurfaceAsObj() [2/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer , typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static 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 2867 of file Shortcuts.h.

2872  {
2873  typedef unsigned long Size;
2874  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
2875  BOOST_CONCEPT_ASSERT(( concepts::CCellEmbedder< TCellEmbedder > ));
2876  std::string dualFaceSubdivision = params[ "faceSubdivision" ].as<std::string>();
2877  const int subdivide
2878  = dualFaceSubdivision == "Naive" ? 1
2879  : dualFaceSubdivision == "Centroid" ? 2
2880  : 0;
2881  const KSpace& K = embedder.space();
2882  // Number and ouput vertices.
2883  std::map< Vertex, Size > vtx_numbering;
2884  std::map< Face, Size > sub_numbering;
2885  Size n = 1; // OBJ vertex numbering start at 1
2886  for ( auto && s : *surface )
2887  {
2888  if ( ! vtx_numbering.count( s ) )
2889  {
2890  vtx_numbering[ s ] = n++;
2891  // Output vertex positions
2892  RealPoint p = embedder( K.unsigns( s ) );
2893  output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
2894  }
2895  }
2896  auto faces = surface->allClosedFaces();
2897  // Prepare centroids if necessary
2898  if ( subdivide == 2 )
2899  {
2900  for ( auto&& f : faces )
2901  {
2902  auto vtcs = surface->verticesAroundFace( f );
2903  Size nv = vtcs.size();
2904  if ( nv > 3 )
2905  {
2906  sub_numbering[ f ] = n++;
2908  for ( auto&& s : vtcs ) p += embedder( K.unsigns( s ) );
2909  p /= nv;
2910  output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
2911  }
2912  }
2913  }
2914  // Outputs closed faces.
2915  if ( subdivide == 0 )
2916  { // No subdivision
2917  for ( auto&& f : faces )
2918  {
2919  output << "f";
2920  auto vtcs = surface->verticesAroundFace( f );
2921  std::reverse( vtcs.begin(), vtcs.end() );
2922  for ( auto&& s : vtcs )
2923  output << " " << vtx_numbering[ s ];
2924  output << std::endl;
2925  }
2926  }
2927  else if ( subdivide == 1 )
2928  { // naive subdivision
2929  for ( auto&& f : faces )
2930  {
2931  auto vtcs = surface->verticesAroundFace( f );
2932  Size nv = vtcs.size();
2933  for ( Size i = 1; i < nv - 1; ++i )
2934  output << "f " << vtx_numbering[ vtcs[ 0 ] ]
2935  << " " << vtx_numbering[ vtcs[ i+1 ] ]
2936  << " " << vtx_numbering[ vtcs[ i ] ] << std::endl;
2937  }
2938  }
2939  else if ( subdivide == 2 )
2940  { // centroid subdivision
2941  for ( auto&& f : faces )
2942  {
2943  auto vtcs = surface->verticesAroundFace( f );
2944  Size nv = vtcs.size();
2945  if ( nv == 3 )
2946  output << "f " << vtx_numbering[ vtcs[ 0 ] ]
2947  << " " << vtx_numbering[ vtcs[ 2 ] ]
2948  << " " << vtx_numbering[ vtcs[ 1 ] ] << std::endl;
2949  else {
2950  Size c = sub_numbering[ f ];
2951  for ( Size i = 0; i < nv; ++i )
2952  {
2953  output << "f " << c
2954  << " " << vtx_numbering[ vtcs[ (i+1)%nv ] ]
2955  << " " << vtx_numbering[ vtcs[ i ] ] << std::endl;
2956  }
2957  }
2958  }
2959  }
2960  return output.good();
2961  }

References DGtal::Shortcuts< TKSpace >::BOOST_CONCEPT_ASSERT(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, K, reverse(), DGtal::KhalimskySpaceND< dim, TInteger >::unsigns(), and DGtal::PointVector< dim, TEuclideanRing, TContainer >::zero.

◆ outputPrimalDigitalSurfaceAsObj() [1/2]

template<typename TKSpace >
template<typename TAnyDigitalSurface >
static 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 2733 of file Shortcuts.h.

2736  {
2737  auto embedder = getCellEmbedder( surface );
2738  return outputPrimalDigitalSurfaceAsObj( output, surface, embedder );
2739  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder().

◆ outputPrimalDigitalSurfaceAsObj() [2/2]

template<typename TKSpace >
template<typename TAnyDigitalSurface , typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static 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 2761 of file Shortcuts.h.

2765  {
2766  auto surfels = getSurfelRange( surface, Parameters( "Traversal", "Default" ) );
2767  return outputSurfelsAsObj( output, surfels, embedder );
2768  }

References DGtal::Shortcuts< TKSpace >::getSurfelRange(), and DGtal::Shortcuts< TKSpace >::outputSurfelsAsObj().

◆ outputPrimalIdxDigitalSurfaceAsObj() [1/2]

template<typename TKSpace >
static 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 2779 of file Shortcuts.h.

2782  {
2783  auto embedder = getCellEmbedder( surface );
2784  return outputPrimalIdxDigitalSurfaceAsObj( output, surface, embedder );
2785  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder().

◆ outputPrimalIdxDigitalSurfaceAsObj() [2/2]

template<typename TKSpace >
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static 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 2802 of file Shortcuts.h.

2806  {
2807  auto idxsurfels = getIdxSurfelRange( surface, Parameters( "Traversal", "Default" ) );
2808  auto surfelmap = surface->surfels();
2809  SurfelRange surfels;
2810  for ( auto&& idx : idxsurfels )
2811  surfels.push_back( surfelmap[ idx ] );
2812  return outputSurfelsAsObj( output, surfels, embedder );
2813  }

References DGtal::Shortcuts< TKSpace >::getIdxSurfelRange(), DGtal::Shortcuts< TKSpace >::outputSurfelsAsObj(), and DGtal::IndexedDigitalSurface< TDigitalSurfaceContainer >::surfels().

◆ outputSCellMapAsCSV()

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

Definition at line 3063 of file Shortcuts.h.

3068  {
3069  SCellWriter w;
3070  for ( auto&& v : anyMap )
3071  {
3072  w( output, K, v.first );
3073  writer( output, v.second );
3074  output << std::endl;
3075  }
3076  return output.good();
3077  }

References K.

◆ outputSurfelsAsObj()

template<typename TKSpace >
template<typename TCellEmbedder = CanonicCellEmbedder< KSpace >>
static 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 2682 of file Shortcuts.h.

2686  {
2687  typedef unsigned long Size;
2688  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
2689  BOOST_CONCEPT_ASSERT(( concepts::CCellEmbedder< TCellEmbedder > ));
2690  const KSpace& K = embedder.space();
2691  // Number and output vertices.
2692  std::map< Cell, Size > vtx_numbering;
2693  Size n = 1; // OBJ vertex numbering start at 1
2694  for ( auto&& s : surfels )
2695  {
2696  auto primal_vtcs = getPointelRange( K, s, true );
2697  for ( auto&& primal_vtx : primal_vtcs )
2698  {
2699  if ( ! vtx_numbering.count( primal_vtx ) )
2700  {
2701  vtx_numbering[ primal_vtx ] = n++;
2702  // Output vertex positions
2703  RealPoint p = embedder( primal_vtx );
2704  output << "v " << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
2705  }
2706  }
2707  }
2708  // Outputs all faces
2709  for ( auto&& s : surfels )
2710  {
2711  output << "f";
2712  auto primal_vtcs = getPointelRange( K, s, true );
2713  for ( auto&& primal_vtx : primal_vtcs )
2714  output << " " << vtx_numbering[ primal_vtx ];
2715  output << std::endl;
2716  }
2717  return output.good();
2718  }

References DGtal::Shortcuts< TKSpace >::BOOST_CONCEPT_ASSERT(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::Shortcuts< TKSpace >::getPointelRange(), and K.

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

◆ parametersBinaryImage()

template<typename TKSpace >
static 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 546 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersDigitalSurface()

template<typename TKSpace >
static 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 995 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersDigitizedImplicitShape3D()

template<typename TKSpace >
static 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 460 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersGrayScaleImage()

template<typename TKSpace >
static 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 722 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersImplicitShape3D()

template<typename TKSpace >
static 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 264 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersKSpace()

template<typename TKSpace >
static 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 310 of file Shortcuts.h.

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

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersMesh()

template<typename TKSpace >
static 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 2035 of file Shortcuts.h.

2036  {
2037  return Parameters
2038  ( "faceSubdivision", "Centroid" );
2039  }

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ parametersUtilities()

template<typename TKSpace >
static 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 2544 of file Shortcuts.h.

2545  {
2546  return Parameters
2547  ( "colormap", "Custom" )
2548  ( "zero-tic", 0.0 );
2549  }

Referenced by DGtal::Shortcuts< TKSpace >::defaultParameters().

◆ refKSpace() [1/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 417 of file Shortcuts.h.

419  {
420  return surface->container().space();
421  }

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

◆ refKSpace() [2/2]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 428 of file Shortcuts.h.

430  {
431  return surface->container().space();
432  }

◆ saveBinaryImage()

template<typename TKSpace >
static 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 706 of file Shortcuts.h.

708  {
709  auto gray_scale_image = makeGrayScaleImage( bimage );
710  return saveGrayScaleImage( gray_scale_image, output );
711  }

References DGtal::Shortcuts< TKSpace >::makeGrayScaleImage(), and DGtal::Shortcuts< TKSpace >::saveGrayScaleImage().

Referenced by main().

◆ saveGrayScaleImage()

template<typename TKSpace >
static 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 782 of file Shortcuts.h.

784  {
786  ::exportFile( output, *gray_scale_image );
787  }

References DGtal::GenericWriter< TContainer, Tdim, TValue, TFunctor >::exportFile().

Referenced by DGtal::Shortcuts< TKSpace >::saveBinaryImage().

◆ saveOBJ() [1/7]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1857 of file Shortcuts.h.

1865  {
1866  auto embedder = getCellEmbedder( digsurf );
1867  return saveOBJ( digsurf, embedder, normals, diffuse_colors, objfile,
1868  ambient_color, diffuse_color, specular_color );
1869  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder(), and DGtal::Shortcuts< TKSpace >::saveOBJ().

◆ saveOBJ() [2/7]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer , typename TCellEmbedder >
static 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 1737 of file Shortcuts.h.

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

References DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::MeshHelpers::exportMTLNewMaterial(), DGtal::Shortcuts< TKSpace >::getPointelRange(), K, and DGtal::Shortcuts< TKSpace >::refKSpace().

Referenced by main(), DGtal::Shortcuts< TKSpace >::saveOBJ(), and TEST_CASE().

◆ saveOBJ() [3/7]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1908 of file Shortcuts.h.

1914  {
1915  auto embedder = getCellEmbedder( digsurf );
1916  return saveOBJ( digsurf, embedder, RealVectors(), Colors(), objfile,
1917  ambient_color, diffuse_color, specular_color );
1918  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder(), and DGtal::Shortcuts< TKSpace >::saveOBJ().

◆ saveOBJ() [4/7]

template<typename TKSpace >
template<typename TPoint >
static 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 2439 of file Shortcuts.h.

2447  {
2448  std::string mtlfile;
2449  auto lastindex = objfile.find_last_of(".");
2450  if ( lastindex == std::string::npos )
2451  {
2452  mtlfile = objfile + ".mtl";
2453  objfile = objfile + ".obj";
2454  }
2455  else
2456  {
2457  mtlfile = objfile.substr(0, lastindex) + ".mtl";
2458  }
2459  std::ofstream output( objfile.c_str() );
2461  ( output, mtlfile, *polysurf, normals, diffuse_colors,
2462  ambient_color, diffuse_color, specular_color );
2463  output.close();
2464  return ok;
2465  }

References DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor().

◆ saveOBJ() [5/7]

template<typename TKSpace >
template<typename TPoint >
static 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 2370 of file Shortcuts.h.

2373  {
2374  std::ofstream output( objfile.c_str() );
2375  bool ok = MeshHelpers::exportOBJ( output, *polysurf );
2376  output.close();
2377  return ok;
2378  }

References DGtal::MeshHelpers::exportOBJ().

◆ saveOBJ() [6/7]

template<typename TKSpace >
template<typename TPoint >
static 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 2481 of file Shortcuts.h.

2489  {
2490  std::string mtlfile;
2491  auto lastindex = objfile.find_last_of(".");
2492  if ( lastindex == std::string::npos )
2493  {
2494  mtlfile = objfile + ".mtl";
2495  objfile = objfile + ".obj";
2496  }
2497  else
2498  {
2499  mtlfile = objfile.substr(0, lastindex) + ".mtl";
2500  }
2501  std::ofstream output( objfile.c_str() );
2503  ( output, mtlfile, *trisurf, normals, diffuse_colors,
2504  ambient_color, diffuse_color, specular_color );
2505  output.close();
2506  return ok;
2507  }

References DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor().

◆ saveOBJ() [7/7]

template<typename TKSpace >
template<typename TPoint >
static 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 2415 of file Shortcuts.h.

2418  {
2419  std::ofstream output( objfile.c_str() );
2420  bool ok = MeshHelpers::exportOBJ( output, *trisurf );
2421  output.close();
2422  return ok;
2423  }

References DGtal::MeshHelpers::exportOBJ().

◆ saveOFF() [1/4]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer , typename TCellEmbedder >
static 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 1671 of file Shortcuts.h.

1677  {
1678  BOOST_STATIC_ASSERT (( KSpace::dimension == 3 ));
1679 
1680  std::ofstream output_off( off_file.c_str() );
1681  output_off << "OFF" << std::endl;
1682  output_off << "# Generated from DGtal::Shortcuts from the DGTal library" << std::endl;
1683  Cell2Index c2i;
1684  auto pointels = getPointelRange( c2i, digsurf );
1685  output_off << pointels.size() << " " << digsurf->size() << " " << 0 << " " << std::endl;
1686 
1687 
1688  // Number and output vertices.
1689  const KSpace& K = refKSpace( digsurf );
1690  for ( auto&& pointel : pointels )
1691  {
1692  RealPoint p = embedder( pointel );
1693  output_off << p[ 0 ] << " " << p[ 1 ] << " " << p[ 2 ] << std::endl;
1694  }
1695 
1696  // Taking care of faces
1697  for ( auto&& surfel : *digsurf )
1698  {
1699  auto primal_vtcs = getPointelRange( K, surfel );
1700  output_off << primal_vtcs.size();
1701  {
1702  for ( auto&& primal_vtx : primal_vtcs )
1703  output_off << " " << (c2i[ primal_vtx ]);
1704  }
1705  if(face_color != DGtal::Color::None)
1706  {
1707  output_off << " ";
1708  output_off << face_color.r() << " " << face_color.g()
1709  << " " << face_color.b() << " " << face_color.a();
1710  }
1711  output_off << std::endl;
1712  }
1713  return output_off.good();
1714  }

References DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::Shortcuts< TKSpace >::getPointelRange(), K, DGtal::Color::None, and DGtal::Shortcuts< TKSpace >::refKSpace().

Referenced by DGtal::Shortcuts< TKSpace >::saveOFF().

◆ saveOFF() [2/4]

template<typename TKSpace >
template<typename TDigitalSurfaceContainer >
static 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 1886 of file Shortcuts.h.

1890  {
1891  auto embedder = getCellEmbedder( digsurf );
1892  return saveOFF( digsurf, embedder, off_file, face_color);
1893  }

References DGtal::Shortcuts< TKSpace >::getCellEmbedder(), and DGtal::Shortcuts< TKSpace >::saveOFF().

◆ saveOFF() [3/4]

template<typename TKSpace >
template<typename TPoint >
static 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 2390 of file Shortcuts.h.

2394  {
2397  std::ofstream output( off_file.c_str() );
2398  for (unsigned int i=0; i< m.nbFaces(); i++)
2399  {
2400  m.setFaceColor(i, face_color);
2401  }
2402  bool ok = MeshWriter< TPoint >::export2OFF( output, m, true );
2403  output.close();
2404  return ok;
2405  }

References DGtal::MeshWriter< TPoint >::export2OFF(), and DGtal::MeshHelpers::polygonalSurface2Mesh().

◆ saveOFF() [4/4]

template<typename TKSpace >
template<typename TPoint >
static 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 2519 of file Shortcuts.h.

2523  {
2526  std::ofstream output( off_file.c_str() );
2527  for (unsigned int i=0; i< m.nbFaces(); i++)
2528  {
2529  m.setFaceColor(i, face_color);
2530  }
2531  bool ok = MeshWriter< TPoint >::export2OFF( output, m, true );
2532  output.close();
2533  return ok;
2534  }

References DGtal::MeshWriter< TPoint >::export2OFF(), and DGtal::MeshHelpers::triangulatedSurface2Mesh().

◆ saveVectorFieldOBJ()

template<typename TKSpace >
static 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 1937 of file Shortcuts.h.

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

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::begin(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::crossProduct(), DGtal::KhalimskySpaceND< dim, TInteger >::dimension, DGtal::PointVector< dim, TEuclideanRing, TContainer >::end(), and DGtal::MeshHelpers::exportMTLNewMaterial().

Referenced by main().

◆ 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 3206 of file Shortcuts.h.

3207  {
3208  out << "[Shortcuts]";
3209  }

The documentation for this class was generated from the following file:
DGtal::Shortcuts::Color
::DGtal::Color Color
Definition: Shortcuts.h:190
DGtal::Shortcuts::makePrimalPolygonalSurface
static CountedPtr< PolygonalSurface > makePrimalPolygonalSurface(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition: Shortcuts.h:2320
DGtal::CMAP_SUMMER
@ CMAP_SUMMER
Definition: GradientColorMap.h:63
DGtal::CMAP_SPRING
@ CMAP_SPRING
Definition: GradientColorMap.h:62
DGtal::KhalimskySpaceND::dimension
static constexpr const Dimension dimension
Definition: KhalimskySpaceND.h:430
DGtal::Shortcuts::Cell2Index
std::map< Cell, IdxVertex > Cell2Index
Definition: Shortcuts.h:188
DGtal::PointVector::zero
static Self zero
Static const for zero PointVector.
Definition: PointVector.h:1590
DGtal::KhalimskySpaceND::upperBound
const Point & upperBound() const
Return the upper bound for digital points in this space.
DGtal::GenericReader::import
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
DGtal::Shortcuts::PointelRange
CellRange PointelRange
Definition: Shortcuts.h:175
DGtal::KhalimskySpaceND::uDim
Dimension uDim(const Cell &p) const
Return the dimension of the cell [p].
DGtal::Shortcuts::TriangulatedSurface
::DGtal::TriangulatedSurface< RealPoint > TriangulatedSurface
Definition: Shortcuts.h:185
DGtal::Shortcuts::makeGrayScaleImage
static CountedPtr< GrayScaleImage > makeGrayScaleImage(Domain aDomain)
Definition: Shortcuts.h:735
DGtal::Shortcuts::getCellEmbedder
static CanonicCellEmbedder< KSpace > getCellEmbedder(const KSpace &K)
Definition: Shortcuts.h:437
max
int max(int a, int b)
Definition: testArithmeticalDSS.cpp:1108
DGtal::MeshHelpers::polygonalSurface2Mesh
static void polygonalSurface2Mesh(const PolygonalSurface< Point > &polysurf, Mesh< Point > &mesh)
DGtal::Shortcuts::saveOFF
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:1672
DGtal::Shortcuts::getCellRange
static CellRange getCellRange(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Dimension k)
Definition: Shortcuts.h:1398
DGtal::SurfelAdjacency< KSpace::dimension >
DGtal::Shortcuts::IdxSurfel
IdxDigitalSurface::Vertex IdxSurfel
Definition: Shortcuts.h:168
DGtal::Trace::error
std::ostream & error()
DGtal::Shortcuts::makeDoubleImage
static CountedPtr< DoubleImage > makeDoubleImage(Domain aDomain)
Definition: Shortcuts.h:929
DGtal::HyperRectDomain::upperBound
const Point & upperBound() const
DGtal::KhalimskySpaceND::init
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
DGtal::Shortcuts::ExplicitSurfaceContainer
SetOfSurfels< KSpace, SurfelSet > ExplicitSurfaceContainer
defines a heavy container that represents any digital surface.
Definition: Shortcuts.h:156
DGtal::Shortcuts::ColorMap
GradientColorMap< Scalar > ColorMap
Definition: Shortcuts.h:192
DGtal::trace
Trace trace
Definition: Common.h:150
DGtal::Shortcuts::Colors
std::vector< Color > Colors
Definition: Shortcuts.h:191
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Shortcuts::IdxDigitalSurface
IndexedDigitalSurface< ExplicitSurfaceContainer > IdxDigitalSurface
defines a connected or not indexed digital surface.
Definition: Shortcuts.h:160
DGtal::Shortcuts::refKSpace
static const KSpace & refKSpace(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
Definition: Shortcuts.h:418
DGtal::Shortcuts::makeDigitalSurface
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1208
DGtal::Shortcuts::FloatImage
ImageContainerBySTLVector< Domain, float > FloatImage
defines a float image with (hyper-)rectangular domain.
Definition: Shortcuts.h:145
DGtal::Shortcuts::BinaryImage
ImageContainerBySTLVector< Domain, bool > BinaryImage
defines a black and white image with (hyper-)rectangular domain.
Definition: Shortcuts.h:141
DGtal::MeshWriter::export2OFF
static bool export2OFF(std::ostream &out, const Mesh< TPoint > &aMesh, bool exportColor=true)
DGtal::Shortcuts::parametersDigitalSurface
static Parameters parametersDigitalSurface()
Definition: Shortcuts.h:995
DGtal::KhalimskySpaceND::lowerBound
const Point & lowerBound() const
Return the lower bound for digital points in this space.
DGtal::Color::Black
static const Color Black
Definition: Color.h:397
DGtal::Shortcuts::parametersBinaryImage
static Parameters parametersBinaryImage()
Definition: Shortcuts.h:546
DGtal::Shortcuts::Surfel2Index
std::map< Surfel, IdxSurfel > Surfel2Index
Definition: Shortcuts.h:187
Visitor
BreadthFirstVisitor< MyDigitalSurface > Visitor
Definition: greedy-plane-segmentation-ex2.cpp:97
DGtal::Shortcuts::RealVectors
std::vector< RealVector > RealVectors
Definition: Shortcuts.h:179
DGtal::Shortcuts::ZeroTickedColorMap
TickedColorMap< Scalar, ColorMap > ZeroTickedColorMap
Definition: Shortcuts.h:193
DGtal::MeshHelpers::exportMTLNewMaterial
static bool exportMTLNewMaterial(std::ostream &output_mtl, unsigned int idxMaterial, const Color &ambient_color, const Color &diffuse_color, const Color &specular_color)
DGtal::MeshHelpers::digitalSurface2DualPolygonalSurface
static void digitalSurface2DualPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, VertexMap &vertexmap)
DGtal::MeshHelpers::mesh2PolygonalSurface
static bool mesh2PolygonalSurface(const Mesh< Point > &mesh, PolygonalSurface< Point > &polysurf)
DGtal::MeshHelpers::digitalSurface2PrimalPolygonalSurface
static bool digitalSurface2PrimalPolygonalSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, PolygonalSurface< typename CellEmbedder::Value > &polysurf, CellMap &cellmap)
DGtal::MeshHelpers::triangulatedSurface2Mesh
static void triangulatedSurface2Mesh(const TriangulatedSurface< Point > &trisurf, Mesh< Point > &mesh)
DGtal::MPolynomialReader::read
Iterator read(Polynomial &p, Iterator begin, Iterator end)
Definition: MPolynomialReader.h:284
Size
HalfEdgeDataStructure::Size Size
Definition: testHalfEdgeDataStructure.cpp:50
DGtal::KhalimskySpaceND::sDirect
bool sDirect(const SCell &p, Dimension k) const
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
DGtal::KhalimskySpaceND::uFaces
Cells uFaces(const Cell &c) const
Return the proper faces of [c] (chain of lower incidence) that belong to the space.
DGtal::Shortcuts::DigitizedImplicitShape3D
GaussDigitizer< Space, ImplicitShape3D > DigitizedImplicitShape3D
defines the digitization of an implicit shape.
Definition: Shortcuts.h:139
DGtal::Shortcuts::DoubleImage
ImageContainerBySTLVector< Domain, double > DoubleImage
defines a double image with (hyper-)rectangular domain.
Definition: Shortcuts.h:147
DGtal::MeshHelpers::exportOBJ
static bool exportOBJ(std::ostream &output, const TriangulatedSurface< Point > &trisurf)
DGtal::PointVector::crossProduct
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
DGtal::CMAP_HOT
@ CMAP_HOT
Definition: GradientColorMap.h:68
DGtal::Shortcuts::RealVector
Space::RealVector RealVector
Vector with floating-point coordinates.
Definition: Shortcuts.h:121
DGtal::Shortcuts::makeFloatImage
static CountedPtr< FloatImage > makeFloatImage(Domain aDomain)
Definition: Shortcuts.h:863
DGtal::Surfaces::sMakeBoundary
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor
static bool exportOBJwithFaceNormalAndColor(std::ostream &output_obj, const std::string &mtl_filename, const TTriangulatedOrPolygonalSurface &polysurf, const std::vector< typename TTriangulatedOrPolygonalSurface::Point > &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)
DGtal::Shortcuts::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::Shortcuts::DigitalSurface
::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface
defines an arbitrary digital surface over a binary image.
Definition: Shortcuts.h:158
DGtal::Shortcuts::parametersMesh
static Parameters parametersMesh()
Definition: Shortcuts.h:2035
DGtal::Shortcuts::parametersKSpace
static Parameters parametersKSpace()
Definition: Shortcuts.h:310
DGtal::Shortcuts::GrayScaleImage
ImageContainerBySTLVector< Domain, GrayScale > GrayScaleImage
defines a grey-level image with (hyper-)rectangular domain.
Definition: Shortcuts.h:143
DGtal::Shortcuts::KSpace
TKSpace KSpace
Digital cellular space.
Definition: Shortcuts.h:111
DGtal::Mesh
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition: Mesh.h:92
DGtal::Shortcuts::Scalar
RealVector::Component Scalar
Floating-point numbers.
Definition: Shortcuts.h:125
DGtal::Shortcuts::parametersDigitizedImplicitShape3D
static Parameters parametersDigitizedImplicitShape3D()
Definition: Shortcuts.h:460
reverse
ch reverse()
DGtal::Surfaces::findABel
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Domain
HyperRectDomain< Space > Domain
Definition: testSimpleRandomAccessRangeFromPoint.cpp:44
DGtal::Shortcuts::makeIdxDigitalSurface
static CountedPtr< IdxDigitalSurface > makeIdxDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1274
DGtal::Shortcuts::ScalarPolynomial
MPolynomial< Space::dimension, Scalar > ScalarPolynomial
defines a multi-variate polynomial : RealPoint -> Scalar
Definition: Shortcuts.h:134
DGtal::CMAP_JET
@ CMAP_JET
Definition: GradientColorMap.h:69
DGtal::Shortcuts::outputDualDigitalSurfaceAsObj
static bool outputDualDigitalSurfaceAsObj(std::ostream &output, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersMesh())
Definition: Shortcuts.h:2834
DGtal::Shortcuts::parametersGrayScaleImage
static Parameters parametersGrayScaleImage()
Definition: Shortcuts.h:722
DGtal::Shortcuts::getSCellEmbedder
static CanonicSCellEmbedder< KSpace > getSCellEmbedder(const KSpace &K)
Definition: Shortcuts.h:445
DGtal::PointVector::end
Iterator end()
DGtal::KhalimskySpaceND::uCoords
Point uCoords(const Cell &c) const
Return its digital coordinates.
DGtal::HyperRectDomain::end
const ConstIterator & end() const
Definition: HyperRectDomain.h:201
DGtal::Shortcuts::LightSurfaceContainer
LightImplicitDigitalSurface< KSpace, BinaryImage > LightSurfaceContainer
Definition: Shortcuts.h:152
DGtal::MeshHelpers::polygonalSurface2TriangulatedSurface
static void polygonalSurface2TriangulatedSurface(const PolygonalSurface< Point > &polysurf, TriangulatedSurface< Point > &trisurf, bool centroid=true)
DGtal::Shortcuts::Idx
IdxVertex Idx
Definition: Shortcuts.h:181
DGtal::Shortcuts::getColorMap
static ColorMap getColorMap(Scalar min, Scalar max, const Parameters &params=parametersUtilities())
Definition: Shortcuts.h:2619
DGtal::Shortcuts::SurfelRange
SCellRange SurfelRange
Definition: Shortcuts.h:176
DGtal::PointVector::begin
Iterator begin()
DGtal::CMAP_COOL
@ CMAP_COOL
Definition: GradientColorMap.h:66
DGtal::CMAP_AUTUMN
@ CMAP_AUTUMN
Definition: GradientColorMap.h:64
Vector
FreemanChain< int >::Vector Vector
Definition: testCombinDSS.cpp:60
DGtal::Shortcuts::LightDigitalSurface
::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface
defines a connected digital surface over a binary image.
Definition: Shortcuts.h:154
DGtal::Shortcuts::parametersImplicitShape3D
static Parameters parametersImplicitShape3D()
Definition: Shortcuts.h:264
DGtal::Shortcuts::getPrimalCells
static CellRange getPrimalCells(const KSpace &K, const SCell &s, const Dimension k)
Definition: Shortcuts.h:3115
DGtal::KhalimskySpaceND::sOrthDir
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
DGtal::Shortcuts::IdxRange
std::vector< IdxVertex > IdxRange
Definition: Shortcuts.h:182
DGtal::Shortcuts::makeLightDigitalSurface
static CountedPtr< LightDigitalSurface > makeLightDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1061
DGtal::Shortcuts::getKSpace
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition: Shortcuts.h:331
DGtal::MPolynomialReader
Aim: This class converts a string polynomial expression in a multivariate polynomial.
Definition: MPolynomialReader.h:259
DGtal::Shortcuts::getPointelRange
static PointelRange getPointelRange(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface)
Definition: Shortcuts.h:1468
DGtal::Shortcuts::CellRange
std::vector< Cell > CellRange
Definition: Shortcuts.h:174
DGtal::Shortcuts::Surfel
LightDigitalSurface::Surfel Surfel
Definition: Shortcuts.h:161
domain
Domain domain
Definition: testProjection.cpp:88
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
DGtal::Shortcuts::ImplicitShape3D
ImplicitPolynomial3Shape< Space > ImplicitShape3D
Definition: Shortcuts.h:137
DGtal::Shortcuts::parametersUtilities
static Parameters parametersUtilities()
Definition: Shortcuts.h:2544
DGtal::Shortcuts::getIdxSurfelRange
static IdxSurfelRange getIdxSurfelRange(CountedPtr< IdxDigitalSurface > surface, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1611
DGtal::Shortcuts::PolygonalSurface
::DGtal::PolygonalSurface< RealPoint > PolygonalSurface
Definition: Shortcuts.h:186
DGtal::MeshHelpers::mesh2TriangulatedSurface
static bool mesh2TriangulatedSurface(const Mesh< Point > &mesh, TriangulatedSurface< Point > &trisurf)
DGtal::CMAP_COPPER
@ CMAP_COPPER
Definition: GradientColorMap.h:67
DGtal::Shortcuts::getPrimalVertices
static CellRange getPrimalVertices(const KSpace &K, const SCell &s)
Definition: Shortcuts.h:3131
DGtal::Color::None
static const Color None
Definition: Color.h:396
DGtal::GenericWriter::exportFile
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
DGtal::Shortcuts::saveOBJ
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:1738
DGtal::Shortcuts::IdxSurfelRange
std::vector< IdxSurfel > IdxSurfelRange
Definition: Shortcuts.h:177
DGtal::Shortcuts::makeLightDigitalSurfaces
static std::vector< CountedPtr< LightDigitalSurface > > makeLightDigitalSurfaces(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1118
DGtal::KhalimskySpaceND::unsigns
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
DGtal::Shortcuts::makeDualPolygonalSurface
static CountedPtr< PolygonalSurface > makeDualPolygonalSurface(Surfel2Index &s2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition: Shortcuts.h:2267
DGtal::Trace::warning
std::ostream & warning()
DGtal::Shortcuts::getSurfelRange
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1546
DGtal::HyperRectDomain::begin
const ConstIterator & begin() const
Definition: HyperRectDomain.h:176
DGtal::Shortcuts::makeBinaryImage
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
Definition: Shortcuts.h:560
DGtal::Shortcuts::outputPrimalIdxDigitalSurfaceAsObj
static bool outputPrimalIdxDigitalSurfaceAsObj(std::ostream &output, CountedPtr< IdxDigitalSurface > surface)
Definition: Shortcuts.h:2780
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::Shortcuts::saveGrayScaleImage
static bool saveGrayScaleImage(CountedPtr< GrayScaleImage > gray_scale_image, std::string output)
Definition: Shortcuts.h:783
DGtal::Shortcuts::Mesh
::DGtal::Mesh< RealPoint > Mesh
Definition: Shortcuts.h:184
DGtal::Shortcuts::outputSurfelsAsObj
static bool outputSurfelsAsObj(std::ostream &output, const SurfelRange &surfels, const TCellEmbedder &embedder)
Definition: Shortcuts.h:2683
DGtal::CMAP_WINTER
@ CMAP_WINTER
Definition: GradientColorMap.h:65
DGtal::Shortcuts::makeTriangulatedSurface
static CountedPtr< TriangulatedSurface > makeTriangulatedSurface(CountedPtr< Mesh > aMesh)
Definition: Shortcuts.h:2053
DGtal::Shortcuts::getPolynomialList
static std::map< std::string, std::string > getPolynomialList()
Definition: Shortcuts.h:235
DGtal::HyperRectDomain::lowerBound
const Point & lowerBound() const
DGtal::MeshHelpers::digitalSurface2DualTriangulatedSurface
static void digitalSurface2DualTriangulatedSurface(const DigitalSurface< DigitalSurfaceContainer > &dsurf, const CellEmbedder &cembedder, TriangulatedSurface< typename CellEmbedder::Value > &trisurf, VertexMap &vertexmap)
DGtal::Shortcuts::outputPrimalDigitalSurfaceAsObj
static bool outputPrimalDigitalSurfaceAsObj(std::ostream &output, CountedPtr< TAnyDigitalSurface > surface)
Definition: Shortcuts.h:2734
SurfelSet
MyDigitalSurface::SurfelSet SurfelSet
Definition: greedy-plane-segmentation-ex2.cpp:95
DGtal::InputException
Definition: Exceptions.h:64
DGtal::KhalimskySpaceND
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Definition: KhalimskySpaceND.h:394