DGtal  1.4.2
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)
35 #define GenericWriter_RECURSES
36 
37 #if !defined GenericWriter_h
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)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
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
void operator>>(const Display3D< Space, KSpace > &aDisplay3D, DGtal::Mesh< typename Display3D< Space, KSpace >::RealPoint > &aMesh)
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, typename TContainer::Value, DGtal::uint64_t >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const std::string &datasetName="UInt8Array3D", const TFunctor &aFunctor=TFunctor())
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const std::string &datasetName="UInt8Array3D", const TFunctor &aFunctor=TFunctor())
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, typename TContainer::Value, unsigned char >))
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
Aim: Provide a mechanism to save image (2D or 3D) into file with the best saver loader according to a...
Definition: GenericWriter.h:95
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TContainer >))
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:95
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer