DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions
DGtal::RawReader< TImageContainer, TFunctor > Struct Template Reference

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

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

Public Types

typedef TImageContainer ImageContainer
 
typedef TImageContainer::Value Value
 
typedef TImageContainer::Domain::Vector Vector
 
typedef TFunctor Functor
 

Static Public Member Functions

template<typename Word >
static ImageContainer importRaw (const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
 
static ImageContainer importRaw8 (const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
 
static ImageContainer importRaw16 (const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
 
static ImageContainer importRaw32 (const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
 

Detailed Description

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

Aim: Raw binary import of an Image.

Description of template class 'RawReader'

The import methods importRaw8, importRaw16 and importRaw32 read raw files (little-endian format) containing unsigned integer values of, respectively, 8 bits, 16 bits and 32 bits width. The method importRaw can read any type of values, signed integers, floating point types or even structures.

All these methods return an instance of the template parameter TImageContainer. A functor can be specified to convert raw values to image values.

Example usage:

...
typedef DGtal::SpaceND<int,3> Space3;
typedef TDomain::Point Point;
//Default image container = STLVector
Image image = reader.importRaw8("data.raw");
trace.info() << image <<endl;
...
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
std::ostream & info()
Trace trace
Definition: Common.h:154
Aim: Raw binary import of an Image.
Definition: RawReader.h:94
static ImageContainer importRaw8(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
MyPointD Point
Definition: testClone2.cpp:383
Template Parameters
TImageContainerthe image container to use.
TFunctorthe type of functor used in the import (by default set to functors::Cast< TImageContainer::Value>) .
See also
RawWriter
testRawReader.cpp

Definition at line 93 of file RawReader.h.

Member Typedef Documentation

◆ Functor

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

Definition at line 101 of file RawReader.h.

◆ ImageContainer

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

Definition at line 98 of file RawReader.h.

◆ Value

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

Definition at line 99 of file RawReader.h.

◆ Vector

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

Definition at line 100 of file RawReader.h.

Member Function Documentation

◆ importRaw()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
template<typename Word >
static ImageContainer DGtal::RawReader< TImageContainer, TFunctor >::importRaw ( const std::string &  filename,
const Vector extent,
const Functor aFunctor = Functor() 
)
static

Method to import a Raw (any type stored in little-endian format) into an instance of the template parameter ImageContainer.

Template Parameters
Wordread pixel type.
Parameters
filenamethe file name to import.
extentthe size of the raw data set.
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 > ). aFunctor must accept Word as input.
Returns
an instance of the ImageContainer.

◆ importRaw16()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static ImageContainer DGtal::RawReader< TImageContainer, TFunctor >::importRaw16 ( const std::string &  filename,
const Vector extent,
const Functor aFunctor = Functor() 
)
static

Method to import a Raw (unsigned 16bits little endian, uint16_t, unsigned short) into an instance of the template parameter ImageContainer.

Parameters
filenamethe file name to import.
extentthe size of the raw data set.
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 > ). aFunctor must accept uint16_t as input.
Returns
an instance of the ImageContainer.

◆ importRaw32()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static ImageContainer DGtal::RawReader< TImageContainer, TFunctor >::importRaw32 ( const std::string &  filename,
const Vector extent,
const Functor aFunctor = Functor() 
)
static

Method to import a Raw (unsigned 32bits little endian, uint32_t, unsigned int) into an instance of the template parameter ImageContainer.

Parameters
filenamethe file name to import.
extentthe size of the raw data set.
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 > ). aFunctor must accept uint32_t as input.
Returns
an instance of the ImageContainer.

Referenced by DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >::importWithValueFunctor(), and testRawReaderOnRef().

◆ importRaw8()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static ImageContainer DGtal::RawReader< TImageContainer, TFunctor >::importRaw8 ( const std::string &  filename,
const Vector extent,
const Functor aFunctor = Functor() 
)
static

Method to import a Raw (unsigned 8bits little endian, uint8_t, unsigned char) into an instance of the template parameter ImageContainer.

Parameters
filenamethe file name to import.
extentthe size of the raw data set.
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 > ). aFunctor must accept uint8_t as input.
Returns
an instance of the ImageContainer.

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


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