DGtal  0.9.2
PGMWriter.h
1 
17 #pragma once
18 
31 #if defined(PGMWriter_RECURSES)
32 #error Recursive header files inclusion detected in PGMWriter.h
33 #else // defined(PGMWriter_RECURSES)
34 
35 #define PGMWriter_RECURSES
36 
37 #if !defined PGMWriter_h
38 
39 #define PGMWriter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include <boost/static_assert.hpp>
46 #include <boost/type_traits.hpp>
47 #include "DGtal/base/Common.h"
48 #include "DGtal/base/CUnaryFunctor.h"
49 #include "DGtal/base/BasicFunctors.h"
51 
52 namespace DGtal
53 {
54 
56  // template class PGMWriter
87  template <typename TImage, typename TFunctor = functors::Identity>
88  struct PGMWriter
89  {
90  // ----------------------- Standard services ------------------------------
91  typedef TImage Image;
92  typedef typename TImage::Value Value;
93  typedef TFunctor Functor;
94 
96 
97  BOOST_STATIC_ASSERT( (TImage::Domain::dimension == 2) ||
98  (TImage::Domain::dimension == 3));
99 
112  static bool exportPGM(const std::string & filename, const Image &aImage,
113  const Functor & aFunctor = Functor(),
114  bool saveASCII=false, bool topbotomOrder=true);
115 
116 
128  static bool exportPGM3D(const std::string & filename, const Image &aImage,
129  const Functor & aFunctor = Functor(), bool saveASCII=false);
130 
131  };
132 }//namespace
133 
135 // Includes inline functions.
136 #include "DGtal/io/writers/PGMWriter.ih"
137 
138 // //
140 
141 #endif // !defined PGMWriter_h
142 
143 #undef PGMWriter_RECURSES
144 #endif // else defined(PGMWriter_RECURSES)
BOOST_STATIC_ASSERT((TImage::Domain::dimension==2)||(TImage::Domain::dimension==3))
TImage::Value Value
Definition: PGMWriter.h:92
static bool exportPGM3D(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool saveASCII=false)
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, unsigned char >))
DGtal is the top-level namespace which contains all DGtal functions and types.
TFunctor Functor
Definition: PGMWriter.h:93
Aim: Export a 2D and a 3D Image using the Netpbm PGM formats (ASCII mode).
Definition: PGMWriter.h:88
static bool exportPGM(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool saveASCII=false, bool topbotomOrder=true)