DGtal  0.9.3beta
Public Types | Static Public Member Functions
DGtal::RawWriter< TImage, TFunctor > Struct Template Reference

#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 &aImage, const Functor &aFunctor=Functor())
 
static bool exportRaw16 (const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor())
 
static bool exportRaw32 (const std::string &filename, const Image &aImage, 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:

...
typedef Domain::Point Point;
//Default image container = STLVector
Domain domain( Point::diagonal(0), Point::diagonal(10) );
Image image( domain );
... // Filling the image.
if ( writer.exportRaw8( "data.raw", image ) )
trace.info() << "Image successfully exported." << endl;
else
trace.info() << "Error while exporting image." << endl;
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

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

Definition at line 104 of file RawWriter.h.

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

Definition at line 102 of file RawWriter.h.

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

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.
template<typename TImage, typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw16 ( const std::string &  filename,
const Image aImage,
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.
aImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.
template<typename TImage, typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw32 ( const std::string &  filename,
const Image aImage,
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.
aImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.
template<typename TImage, typename TFunctor = functors::Identity>
static bool DGtal::RawWriter< TImage, TFunctor >::exportRaw8 ( const std::string &  filename,
const Image aImage,
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.
aImagethe image to export.
aFunctorfunctor used to cast image values.
Returns
true if no errors occur.

The documentation for this struct was generated from the following file: