DGtal  1.5.beta
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)
35 #define LongvolWriter_RECURSES
36 
37 #if !defined LongvolWriter_h
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 
91  static bool exportLongvol(const std::string & filename, const Image &aImage,
92  const bool compressed = true,
93  const Functor & aFunctor = Functor());
94 
95 
96  private:
97 
106  template <typename Word>
107  static
108  std::ostream& write_word( std::ostream& outs, Word value )
109  {
110  for (unsigned size = sizeof( Word ); size; --size, value >>= 8)
111  outs.put( static_cast <char> (value & 0xFF) );
112  return outs;
113  }
114 
115  };
116 }//namespace
117 
119 // Includes inline functions.
120 #include "DGtal/io/writers/LongvolWriter.ih"
121 
122 // //
124 
125 #endif // !defined LongvolWriter_h
126 
127 #undef LongvolWriter_RECURSES
128 #endif // else defined(LongvolWriter_RECURSES)
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
Aim: Export a 3D Image using the Longvol formats (volumetric image with DGtal::uint64_t value type).
Definition: LongvolWriter.h:70
TImage::Value Value
Definition: LongvolWriter.h:74
static bool exportLongvol(const std::string &filename, const Image &aImage, const bool compressed=true, const Functor &aFunctor=Functor())
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, ValueLongvol >))
static std::ostream & write_word(std::ostream &outs, Word value)
DGtal::uint64_t ValueLongvol
Definition: LongvolWriter.h:76
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90