DGtal  1.5.beta
DGtal::RawWriter< TImage, TFunctor > Struct Template Reference

Aim: Raw binary export of an Image. More...

#include <DGtal/io/writers/RawWriter.h>

Public Types

typedef TImage Image
 
typedef TImage::Value Value
 
typedef TFunctor Functor
 

Static Public Member Functions

template<typename Word >
static bool exportRaw (const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
 
static bool exportRaw8 (const std::string &filename, const Image &anImage, const Functor &aFunctor=Functor())
 
static bool exportRaw16 (const std::string &filename, const Image &anImage, const Functor &aFunctor=Functor())
 
static bool exportRaw32 (const std::string &filename, const Image &anImage, const Functor &aFunctor=Functor())
 

Detailed Description

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:

...
//Default image container = STLVector
Domain domain( Point::diagonal(0), Point::diagonal(10) );
... // Filling the image.
if ( writer.exportRaw8( "data.raw", image ) )
trace.info() << "Image successfully exported." << endl;
else
trace.info() << "Error while exporting image." << endl;
std::ostream & info()
Trace trace
Definition: Common.h:153
Aim: Raw binary export of an Image.
Definition: RawWriter.h:99
static bool exportRaw8(const std::string &filename, const Image &anImage, const Functor &aFunctor=Functor())
MyPointD Point
Definition: testClone2.cpp:383
Domain domain
Image image(domain)
ImageContainerBySTLVector< Domain, Value > Image
HyperRectDomain< Space > Domain
Template Parameters
TImagethe Image type.
TFunctorthe type of functor used in the export.
See also
RawReader
testRawReader.cpp

Definition at line 98 of file RawWriter.h.

Member Typedef Documentation

◆ Functor

template<typename TImage , typename TFunctor = functors::Identity>
typedef TFunctor DGtal::RawWriter< TImage, TFunctor >::Functor

Definition at line 104 of file RawWriter.h.

◆ Image

template<typename TImage , typename TFunctor = functors::Identity>
typedef TImage DGtal::RawWriter< TImage, TFunctor >::Image

Definition at line 102 of file RawWriter.h.

◆ Value

template<typename TImage , typename TFunctor = functors::Identity>
typedef TImage::Value DGtal::RawWriter< TImage, TFunctor >::Value

Definition at line 103 of file RawWriter.h.

Member Function Documentation

◆ exportRaw()

template<typename TImage , typename TFunctor = functors::Identity>
template<typename Word >
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw ( const std::string &  filename,
const Image aImage,
const Functor aFunctor = Functor() 
)
static

Export an Image to Raw format (any value type, in little-endian format).

Template Parameters
Wordexported pixel type.
Parameters
filenamename of the output file.
aImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.

◆ exportRaw16()

template<typename TImage , typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw16 ( const std::string &  filename,
const Image anImage,
const Functor aFunctor = Functor() 
)
static

Export an Image to Raw format (unsigned 16bits little-endian, uint16_t, unsigned short).

Parameters
filenamename of the output file.
anImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.

◆ exportRaw32()

template<typename TImage , typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw32 ( const std::string &  filename,
const Image anImage,
const Functor aFunctor = Functor() 
)
static

Export an Image to Raw format (unsigned 32bits little-endian, uint32_t, unsigned int).

Parameters
filenamename of the output file.
anImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.

◆ exportRaw8()

template<typename TImage , typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw8 ( const std::string &  filename,
const Image anImage,
const Functor aFunctor = Functor() 
)
static

Export an Image to Raw format (unsigned 8bits little-endian, uint8_t, unsigned char).

Parameters
filenamename of the output file.
anImagethe image to export.
aFunctorfunctor 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: