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

Aim: Export a 2D and a 3D Image using the Netpbm PGM formats (ASCII mode). More...

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

Public Types

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

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CUnaryFunctor< TFunctor, Value, unsigned char >))
 
 BOOST_STATIC_ASSERT ((TImage::Domain::dimension==2)||(TImage::Domain::dimension==3))
 

Static Public Member Functions

static bool exportPGM (const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool saveASCII=false, bool topbotomOrder=true)
 
static bool exportPGM3D (const std::string &filename, const Image &aImage, const Functor &aFunctor=Functor(), bool saveASCII=false)
 

Detailed Description

template<typename TImage, typename TFunctor = functors::Identity>
struct DGtal::PGMWriter< TImage, TFunctor >

Aim: Export a 2D and a 3D Image using the Netpbm PGM formats (ASCII mode).

Description of template struct 'PGMWriter'

  • PGM: grayscale
  • PGM3D: 3D variant of PGM

A functor can be specified to convert image values to PGM values (unsigned char).

Usage example:

...
typedef SpaceND<int,2> TSpace;
typedef HyperRectDomain<TSpace> Domain;
...
Point a ( 1, 1);
Point b ( 16, 16);
Image image(a,b);
... //Do something in image
PGMWriter<Image>::exportPPM("export.pgm",image);
ImageContainerBySTLVector< Domain, unsigned char > Type
Definition: ImageSelector.h:78
MyPointD Point
Definition: testClone2.cpp:383
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
testPNMRawWriter.cpp

Definition at line 88 of file PGMWriter.h.

Member Typedef Documentation

◆ Functor

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

Definition at line 93 of file PGMWriter.h.

◆ Image

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

Definition at line 91 of file PGMWriter.h.

◆ Value

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

Definition at line 92 of file PGMWriter.h.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TImage , typename TFunctor = functors::Identity>
DGtal::PGMWriter< TImage, TFunctor >::BOOST_CONCEPT_ASSERT ( (concepts::CUnaryFunctor< TFunctor, Value, unsigned char >)  )

◆ BOOST_STATIC_ASSERT()

template<typename TImage , typename TFunctor = functors::Identity>
DGtal::PGMWriter< TImage, TFunctor >::BOOST_STATIC_ASSERT ( (TImage::Domain::dimension==2)||(TImage::Domain::dimension==3)  )

◆ exportPGM()

template<typename TImage , typename TFunctor = functors::Identity>
static bool DGtal::PGMWriter< TImage, TFunctor >::exportPGM ( const std::string &  filename,
const Image aImage,
const Functor aFunctor = Functor(),
bool  saveASCII = false,
bool  topbotomOrder = true 
)
static

Export an Image with PGM format.

Parameters
filenamename of the output file
aImagethe image to export
aFunctorfunctor used to cast image values
saveASCIIused to save image with ASCII pixel value and with white space. (default= false since ASCII mode is not efficient).
topbotomOrder'true' if the image scan should start from the top.
Returns
true if no errors occur.

Referenced by testPNMWriter(), and testRWIssue254().

◆ exportPGM3D()

template<typename TImage , typename TFunctor = functors::Identity>
static bool DGtal::PGMWriter< TImage, TFunctor >::exportPGM3D ( const std::string &  filename,
const Image aImage,
const Functor aFunctor = Functor(),
bool  saveASCII = false 
)
static

Export an Image with PGM3D format.

Parameters
filenamename of the output file
aImagethe image to export
aFunctorfunctor used to cast image values
saveASCIIused to save image with ASCII pixel value and with white space. (default= false since ASCII mode is not efficient).
Returns
true if no errors occur.

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