DGtal  0.9.2
LongvolWriter.h
1 
17 #pragma once
18 
31 #if defined(LongvolWriter_RECURSES)
32 #error Recursive header files inclusion detected in LongvolWriter.h
33 #else // defined(LongvolWriter_RECURSES)
34 
35 #define LongvolWriter_RECURSES
36 
37 #if !defined LongvolWriter_h
38 
39 #define LongvolWriter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/CUnaryFunctor.h"
47 #include "DGtal/base/BasicFunctors.h"
49 
50 namespace DGtal
51 {
52 
54  // template class LongvolWriter
68  template <typename TImage, typename TFunctor = functors::Identity>
70  {
71  // ----------------------- Standard services ------------------------------
72 
73  typedef TImage Image;
74  typedef typename TImage::Value Value;
75  typedef TFunctor Functor;
77 
79 
80 
90  static bool exportLongvol(const std::string & filename, const Image &aImage,
91  const Functor & aFunctor = Functor()) throw(DGtal::IOException);
92 
93 
94  private:
95 
104  template <typename Word>
105  static
106  std::ostream& write_word( std::ostream& outs, Word value )
107  {
108  for (unsigned size = sizeof( Word ); size; --size, value >>= 8)
109  outs.put( static_cast <char> (value & 0xFF) );
110  return outs;
111  }
112 
113  };
114 }//namespace
115 
117 // Includes inline functions.
118 #include "DGtal/io/writers/LongvolWriter.ih"
119 
120 // //
122 
123 #endif // !defined LongvolWriter_h
124 
125 #undef LongvolWriter_RECURSES
126 #endif // else defined(LongvolWriter_RECURSES)
static std::ostream & write_word(std::ostream &outs, Word value)
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, ValueLongvol >))
STL namespace.
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
Aim: Export a 3D Image using the Longvol formats (volumetric image with DGtal::uint64_t value type)...
Definition: LongvolWriter.h:69
TImage::Value Value
Definition: LongvolWriter.h:74
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint64_t ValueLongvol
Definition: LongvolWriter.h:76
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
static bool exportLongvol(const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())