DGtal 1.4.0
Loading...
Searching...
No Matches
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)
35#define PGMWriter_RECURSES
36
37#if !defined PGMWriter_h
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
52namespace 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)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Export a 2D and a 3D Image using the Netpbm PGM formats (ASCII mode).
Definition PGMWriter.h:89
TFunctor Functor
Definition PGMWriter.h:93
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, unsigned char >))
TImage::Value Value
Definition PGMWriter.h:92
BOOST_STATIC_ASSERT((TImage::Domain::dimension==2)||(TImage::Domain::dimension==3))
static bool exportPGM(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool saveASCII=false, bool topbotomOrder=true)
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.