DGtal  1.3.beta
GenericWriter.h
1 
17 #pragma once
18 
31 #if defined(GenericWriter_RECURSES)
32 #error Recursive header files inclusion detected in GenericWriter.h
33 #else // defined(GenericWriter_RECURSES)
34 
35 #define GenericWriter_RECURSES
36 
37 #if !defined GenericWriter_h
38 
39 #define GenericWriter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/BasicFunctors.h"
46 #include "DGtal/base/CUnaryFunctor.h"
47 #include "DGtal/images/CConstImage.h"
48 #include "DGtal/images/Image.h"
49 #include "DGtal/images/ImageContainerBySTLVector.h"
50 #include "DGtal/images/ImageContainerBySTLMap.h"
51 
52 #include "DGtal/io/colormaps/GradientColorMap.h"
53 #include "DGtal/io/colormaps/HueShadeColorMap.h"
55 
56 namespace DGtal
57 {
58 
60  // template class GenericWriter
90  template <typename TContainer,
91  int Tdim=TContainer::Point::dimension,
92  typename TValue = typename TContainer::Value,
93  typename TFunctor = functors::Identity >
95  {
104  static bool exportFile(const std::string &filename,
105  const TContainer &anImage,
106  const TFunctor & aFunctor = TFunctor() );
107  };
108 
113  template <typename TContainer, typename TFunctor>
114  struct GenericWriter<TContainer, 3 , unsigned char, TFunctor>
115  {
118 
127  static bool exportFile(const std::string &filename, const TContainer &anImage, const std::string &datasetName="UInt8Array3D",
128  const TFunctor & aFunctor = TFunctor() );
129 
130  };
131 
136  template <typename TContainer, typename TFunctor>
137  struct GenericWriter<TContainer, 3 , DGtal::uint64_t, TFunctor>
138  {
139 
142 
143 
151  static bool exportFile(const std::string &filename, const TContainer &anImage,
152  const TFunctor & aFunctor = TFunctor() );
153 
154  };
155 
156 
161  template <typename TContainer, typename TValue, typename TFunctor>
162  struct GenericWriter<TContainer, 3 , TValue, TFunctor>
163  {
173  static bool exportFile(const std::string &filename,
174  const TContainer &anImage,
175  const std::string &datasetName="UInt8Array3D",
176  const TFunctor & aFunctor = TFunctor() );
177 
178  };
179 
184  template <typename TContainer, typename TValue, typename TFunctor>
185  struct GenericWriter<TContainer, 2, TValue, TFunctor>
186  {
188 
197  static bool exportFile(const std::string &filename,
198  const TContainer &anImage,
199  const TFunctor & aFunctor = TFunctor() );
200 
201  };
202 
203 
208  template <typename TContainer, typename TFunctor>
209  struct GenericWriter<TContainer, 2, DGtal::Color, TFunctor>
210  {
212 
221  static bool exportFile(const std::string &filename,
222  const TContainer &anImage,
223  const TFunctor & aFunctor = TFunctor() );
224 
225  };
226 
227 
232  template <typename TContainer, typename TFunctor>
233  struct GenericWriter<TContainer, 2, unsigned char, TFunctor>
234  {
243  static bool exportFile(const std::string &filename, const TContainer &anImage,
244  const TFunctor & aFunctor = TFunctor() );
245 
246  };
247 
257  template <typename TImageContainer >
258  bool
259  operator >> ( const TImageContainer & aContainer, const std::string & aFilename );
260 
261 
262 } // namespace DGtal
263 
264 
266 // Includes inline functions.
267 #include "DGtal/io/writers/GenericWriter.ih"
268 
269 // //
271 
272 #endif // !defined GenericWriter_h
273 
274 #undef GenericWriter_RECURSES
275 #endif // else defined(GenericWriter_RECURSES)
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
DGtal::GenericWriter::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
DGtal::operator>>
void operator>>(const Display3D< Space, KSpace > &aDisplay3D, DGtal::Mesh< typename Display3D< Space, KSpace >::RealPoint > &aMesh)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::GenericWriter
Aim: Provide a mechanism to save image (2D or 3D) into file with the best saver loader according to a...
Definition: GenericWriter.h:94
DGtal::uint64_t
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
DGtal::GenericWriter::exportFile
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
TImageContainer
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer
Definition: testVoronoiMapComplete.cpp:49
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
DGtal::concepts::CConstImage
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38