DGtal  1.5.beta
PPMWriter.h
1 
17 #pragma once
18 
31 #if defined(PPMWriter_RECURSES)
32 #error Recursive header files inclusion detected in PPMWriter.h
33 #else // defined(PPMWriter_RECURSES)
35 #define PPMWriter_RECURSES
36 
37 #if !defined PPMWriter_h
39 #define PPMWriter_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/io/Color.h"
49 #include "DGtal/base/CUnaryFunctor.h"
50 #include "DGtal/base/BasicFunctors.h"
52 
53 namespace DGtal
54 {
55 
57  // template class PPMWriter
71  template <typename TImage, typename TFunctor = functors::Identity>
72  struct PPMWriter
73  {
74  // ----------------------- Standard services ------------------------------
75  typedef TImage Image;
76  typedef typename TImage::Value Value;
77  typedef TFunctor Functor;
79  BOOST_STATIC_ASSERT( (TImage::Domain::dimension == 2) ||
80  (TImage::Domain::dimension == 3));
81 
92  static bool exportPPM(const std::string & filename, const Image &aImage,
93  const Functor & aFunctor = Functor(), bool topbottomOrder=true);
94 
95 
105  static bool exportPPM3D(const std::string & filename, const Image &aImage,
106  const Functor & aFunctor = Functor());
107 
108  };
109 }//namespace
110 
112 // Includes inline functions.
113 #include "DGtal/io/writers/PPMWriter.ih"
114 
115 // //
117 
118 #endif // !defined PPMWriter_h
119 
120 #undef PPMWriter_RECURSES
121 #endif // else defined(PPMWriter_RECURSES)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Export a 2D and a 3D Image using the Netpbm PPM formats (ASCII mode).
Definition: PPMWriter.h:73
TImage::Value Value
Definition: PPMWriter.h:76
BOOST_STATIC_ASSERT((TImage::Domain::dimension==2)||(TImage::Domain::dimension==3))
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, DGtal::Color >))
static bool exportPPM(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool topbottomOrder=true)
TFunctor Functor
Definition: PPMWriter.h:77
static bool exportPPM3D(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90