DGtal  0.9.4beta
Public Types | Public Member Functions | Static Public Member Functions
DGtal::PGMReader< TImageContainer, TFunctor > Struct Template Reference

#include <DGtal/io/readers/PGMReader.h>

Public Types

enum  MagicNumber {
  P1, P2, P3, P4,
  P5, P6
}
 
typedef TImageContainer ImageContainer
 
typedef TImageContainer::Value Value
 
typedef TImageContainer::Domain::Vector Vector
 
typedef TFunctor Functor
 

Public Member Functions

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

Static Public Member Functions

static ImageContainer importPGM (const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true) throw (DGtal::IOException)
 
static ImageContainer importPGM3D (const std::string &aFilename, const Functor &aFunctor=Functor()) throw (DGtal::IOException)
 

Detailed Description

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
struct DGtal::PGMReader< TImageContainer, TFunctor >

Aim: Import a 2D or 3D using the Netpbm formats (ASCII mode).

Description of class 'PGMReader'

#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/readers/PGMReader.h"
#include "DGtal/kernel/images/ImageSelector.h"
...
string filename = "test.pgm";
typedef ImageSelector < Z2i::Domain, uint>::Type Image;
Image image = PGMReader<Image>::importPGM( filename );

You can then for instance display a threshold part of the image:

#include "DGtal/kernel/imagesSetsUtils/SetFromImage.h"
...
Z2i::DigitalSet set2d (image.domain());
// Threshold all pixel in ]0, 255] in a DigitalSet
SetFromImage<Z2i::DigitalSet>::append<Image>(set2d, image, 0, 255);
Board2D board;
board << image.domain() << set2d; // display domain and set
Template Parameters
TImageContainerthe type of the image container
TFunctorthe type of functor used in the import (by default set to functors::Cast< TImageContainer::Value>) .
Examples:
images/exampleRigidtransformation2d.cpp, and topology/ctopo-2.cpp.

Definition at line 97 of file PGMReader.h.

Member Typedef Documentation

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
typedef TFunctor DGtal::PGMReader< TImageContainer, TFunctor >::Functor

Definition at line 106 of file PGMReader.h.

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
typedef TImageContainer DGtal::PGMReader< TImageContainer, TFunctor >::ImageContainer

Definition at line 102 of file PGMReader.h.

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
typedef TImageContainer::Value DGtal::PGMReader< TImageContainer, TFunctor >::Value

Definition at line 103 of file PGMReader.h.

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
typedef TImageContainer::Domain::Vector DGtal::PGMReader< TImageContainer, TFunctor >::Vector

Definition at line 104 of file PGMReader.h.

Member Enumeration Documentation

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
enum DGtal::PGMReader::MagicNumber
Enumerator
P1 
P2 
P3 
P4 
P5 
P6 

Definition at line 108 of file PGMReader.h.

Member Function Documentation

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
DGtal::PGMReader< TImageContainer, TFunctor >::BOOST_CONCEPT_ASSERT ( (concepts::CUnaryFunctor< TFunctor, unsigned char, Value >)  )
template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
DGtal::PGMReader< TImageContainer, TFunctor >::BOOST_STATIC_ASSERT ( (ImageContainer::Domain::dimension==2)||(ImageContainer::Domain::dimension==3)  )
template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
static ImageContainer DGtal::PGMReader< TImageContainer, TFunctor >::importPGM ( const std::string &  aFilename,
const Functor aFunctor = Functor(),
bool  topbotomOrder = true 
)
throw (DGtal::IOException
)
static

Main method to import a Pgm (8bits) into an instance of the template parameter ImageContainer.

Parameters
aFilenamethe file name to import.
aFunctorthe functor used to import and cast the source image values into the type of the image container value (by default set to functors::Cast < TImageContainer::Value > .
topbotomOrderif true, the point of coordinate (0,0) will be the bottom left corner image point (default) else the center of image coordinate will be the top left of the image (not usual).
Returns
an instance of the ImageContainer.
Examples:
tutorial-examples/freemanChainFromImage.cpp.

Referenced by DGtal::GenericReader< TContainer, 2, TValue >::importWithValueFunctor(), and DGtal::GenericReader< TContainer, 2, DGtal::uint32_t >::importWithValueFunctor().

template<typename TImageContainer, typename TFunctor = functors::Cast<typename TImageContainer::Value>>
static ImageContainer DGtal::PGMReader< TImageContainer, TFunctor >::importPGM3D ( const std::string &  aFilename,
const Functor aFunctor = Functor() 
)
throw (DGtal::IOException
)
static

Main method to import a Pgm3D (8bits) into an instance of the template parameter ImageContainer.

Parameters
aFilenamethe file name to import.
aFunctorthe functor used to import and cast the source image values into the type of the image container value (by default set to functors::Cast < TImageContainer::Value > .
Returns
an instance of the ImageContainer.

Referenced by DGtal::GenericReader< TContainer, 3, TValue >::importWithValueFunctor().


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