DGtal  0.9.2
RawReader.h
1 
17 #pragma once
18 
31 #if defined(RawReader_RECURSES)
32 #error Recursive header files inclusion detected in RawReader.h
33 #else // defined(RawReader_RECURSES)
34 
35 #define RawReader_RECURSES
36 
37 #if !defined RawReader_h
38 
39 #define RawReader_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include <cstdio>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/base/CUnaryFunctor.h"
48 #include <boost/static_assert.hpp>
50 
51 namespace DGtal
52 {
53 
55  // template class RawReader
91  template <typename TImageContainer,
92  typename TFunctor = functors::Cast< typename TImageContainer::Value > >
93  struct RawReader
94  {
95  // ----------------------- Standard services ------------------------------
96  public:
97 
98  typedef TImageContainer ImageContainer;
99  typedef typename TImageContainer::Value Value;
100  typedef typename TImageContainer::Domain::Vector Vector;
101  typedef TFunctor Functor;
102 
116  template <typename Word>
117  static ImageContainer importRaw(const std::string & filename,
118  const Vector & extent,
119  const Functor & aFunctor = Functor()) throw(DGtal::IOException);
120 
133  static ImageContainer importRaw8(const std::string & filename,
134  const Vector & extent,
135  const Functor & aFunctor = Functor()) throw(DGtal::IOException);
136 
149  static ImageContainer importRaw16(const std::string & filename,
150  const Vector & extent,
151  const Functor & aFunctor = Functor()) throw(DGtal::IOException);
152 
165  static ImageContainer importRaw32(const std::string & filename,
166  const Vector & extent,
167  const Functor & aFunctor = Functor()) throw(DGtal::IOException);
168 
169 
170  private:
171 
172  }; // end of class RawReader
173 
182  template <typename Word>
183  FILE* raw_reader_read_word( FILE* fin, Word& aValue );
184 
185 } // namespace DGtal
186 
187 
189 // Includes inline functions.
190 #include "DGtal/io/readers/RawReader.ih"
191 
192 // //
194 
195 #endif // !defined RawReader_h
196 
197 #undef RawReader_RECURSES
198 #endif // else defined(RawReader_RECURSES)
TImageContainer::Domain::Vector Vector
Definition: RawReader.h:100
TImageContainer ImageContainer
Definition: RawReader.h:98
STL namespace.
TFunctor Functor
Definition: RawReader.h:101
static ImageContainer importRaw8(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
static ImageContainer importRaw16(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
FILE * raw_reader_read_word(FILE *fin, Word &aValue)
static ImageContainer importRaw(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
DGtal is the top-level namespace which contains all DGtal functions and types.
TImageContainer::Value Value
Definition: RawReader.h:99
Aim: Raw binary import of an Image.
Definition: RawReader.h:93
static ImageContainer importRaw32(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())