Aim: Raw binary export of an Image.
More...
#include <DGtal/io/writers/RawWriter.h>
template<typename TImage, typename TFunctor = functors::Identity>
struct DGtal::RawWriter< TImage, TFunctor >
Aim: Raw binary export of an Image.
Description of template struct 'RawWriter'
The export methods exportRaw8
, exportRaw16
and exportRaw32
write raw files (little-endian format) with unsigned integer values of, respectively, 8 bits, 16 bits and 32 bits width. The method exportRaw
can write any type of values, signed integers, floating point types or even structures.
A functor can be specified to convert image values to raw values (e.g. unsigned char for exportRaw8
).
Example usage:
...
...
trace.
info() <<
"Image successfully exported." << endl;
else
trace.
info() <<
"Error while exporting image." << endl;
Aim: Raw binary export of an Image.
static bool exportRaw8(const std::string &filename, const Image &anImage, const Functor &aFunctor=Functor())
ImageContainerBySTLVector< Domain, Value > Image
HyperRectDomain< Space > Domain
- Template Parameters
-
TImage | the Image type. |
TFunctor | the type of functor used in the export. |
- See also
- RawReader
-
testRawReader.cpp
Definition at line 98 of file RawWriter.h.
◆ Functor
template<typename TImage , typename TFunctor = functors::Identity>
◆ Image
template<typename TImage , typename TFunctor = functors::Identity>
◆ Value
template<typename TImage , typename TFunctor = functors::Identity>
◆ exportRaw()
template<typename TImage , typename TFunctor = functors::Identity>
template<typename Word >
Export an Image to Raw format (any value type, in little-endian format).
- Template Parameters
-
- Parameters
-
filename | name of the output file. |
aImage | the image to export. |
aFunctor | functor used to cast image values. |
- Returns
- true if no errors occur.
◆ exportRaw16()
template<typename TImage , typename TFunctor = functors::Identity>
Export an Image to Raw format (unsigned 16bits little-endian, uint16_t, unsigned short).
- Parameters
-
filename | name of the output file. |
anImage | the image to export. |
aFunctor | functor used to cast image values. |
- Returns
- true if no errors occur.
◆ exportRaw32()
template<typename TImage , typename TFunctor = functors::Identity>
Export an Image to Raw format (unsigned 32bits little-endian, uint32_t, unsigned int).
- Parameters
-
filename | name of the output file. |
anImage | the image to export. |
aFunctor | functor used to cast image values. |
- Returns
- true if no errors occur.
◆ exportRaw8()
template<typename TImage , typename TFunctor = functors::Identity>
Export an Image to Raw format (unsigned 8bits little-endian, uint8_t, unsigned char).
- Parameters
-
filename | name of the output file. |
anImage | the image to export. |
aFunctor | functor used to cast image values. |
- Returns
- true if no errors occur.
Referenced by testPNMWriter().
The documentation for this struct was generated from the following file: