File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
DGtal::GenericReader< TContainer, 2, TValue > Struct Template Reference

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

Inheritance diagram for DGtal::GenericReader< TContainer, 2, TValue >:
[legend]

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CImage< TContainer >))

Static Public Member Functions

static TContainer import (const std::string &filename, unsigned int x=0, unsigned int y=0)
template<typename TFunctor>
static TContainer importWithColorFunctor (const std::string &filename, const TFunctor &aFunctor, unsigned int x=0, unsigned int y=0)
template<typename TFunctor>
static TContainer importWithValueFunctor (const std::string &filename, const TFunctor &aFunctor, unsigned int x=0, unsigned int y=0)

Detailed Description

template<typename TContainer, typename TValue>
struct DGtal::GenericReader< TContainer, 2, TValue >

GenericReader Template partial specialisation for volume images of dimension 2

Definition at line 398 of file GenericReader.h.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TContainer, typename TValue>
DGtal::GenericReader< TContainer, 2, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TContainer >) )

◆ import()

template<typename TContainer, typename TValue>
TContainer DGtal::GenericReader< TContainer, 2, TValue >::import ( const std::string & filename,
unsigned int x = 0,
unsigned int y = 0 )
static

Import a volume image file. For the special format h5 (you need to set DGTAL_WITH_HDF5 of cmake build), the default parameter datasetName needs to be updated according to the dimension if the image.

Parameters
filenamethe image filename to be imported.
xspecify the x image size to be used with raw format.
yspecify the y image size to be used with raw format.

◆ importWithColorFunctor()

template<typename TContainer, typename TValue>
template<typename TFunctor>
TContainer DGtal::GenericReader< TContainer, 2, TValue >::importWithColorFunctor ( const std::string & filename,
const TFunctor & aFunctor,
unsigned int x = 0,
unsigned int y = 0 )
inlinestatic

Import an image file by specifying a color encoder functor (used only for color image format ppm, png, tga, bmp,jpeg) .

Template Parameters
TFunctorThe type of the functor (should verify the concept CUnaryFunctor<TFunctor, TContainer::Value, DGtal::Color > ).
Parameters
filenamethe image filename to be imported.
aFunctoran ColorRGBEncoder. The type of the functor (should verify the concept CUnaryFunctor<TFunctor, TContainer::Value, DGtal::Color > ).
xspecify the x image size to be used with raw format.
yspecify the y image size to be used with raw format.

Definition at line 429 of file GenericReader.h.

433 {
436 //Getting image extension
437 const std::string extension = filename.substr( filename.find_last_of(".") + 1 );
438
439 if ( extension == "ppm" )
440 {
442 }
443 else if ( extension == "raw" )
444 {
445 ASSERT( x != 0 && y != 0 );
446 typename TContainer::Point const pt (x,y);
448 }
449 else if ( extension == "gif" || extension == "jpg" || extension == "png" || extension == "jpeg" || extension == "bmp" || extension == "tga" )
450 {
452 return reader.import( filename, aFunctor );
453 }
454
455 trace.error() << "Extension " << extension<< " in 2D, not yet implemented in DGtal GenericReader." << std::endl;
456 throw dgtalio;
457 }
BOOST_CONCEPT_ASSERT((concepts::CImage< TContainer >))
Aim: Provide a mechanism to load with the bestloader according to an image (2D or 3D) filename (by pa...
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
static ImageContainer importPPM(const std::string &aFilename, const Functor &aFunctor=functors::ColorRGBEncoder< Value >(), bool topbotomOrder=true)

References DGtal::GenericReader< TContainer, Tdim, TValue >::BOOST_CONCEPT_ASSERT(), DGtal::STBReader< TImageContainer, TFunctor >::import(), DGtal::PPMReader< TImageContainer, TFunctor >::importPPM(), and DGtal::trace.

◆ importWithValueFunctor()

template<typename TContainer, typename TValue>
template<typename TFunctor>
TContainer DGtal::GenericReader< TContainer, 2, TValue >::importWithValueFunctor ( const std::string & filename,
const TFunctor & aFunctor,
unsigned int x = 0,
unsigned int y = 0 )
inlinestatic

Import an image file by specifying a value functor used for grayscale image.

Template Parameters
TFunctorThe type of the functor (should verify the concept CUnaryFunctor<TFunctor, unsigned char, TContainer::Value > ).
Parameters
filenamethe image filename to be imported.
aFunctorto transform input unsigned char of image value into the given image type. image.
xspecify the x image size to be used with raw format.
yspecify the y image size to be used with raw format.

Definition at line 472 of file GenericReader.h.

475 {
477
479 //Getting image extension
480 const std::string extension = filename.substr( filename.find_last_of(".") + 1 );
481
482 if ( extension == "raw" )
483 {
484 ASSERT( x!= 0 && y != 0);
485 typename TContainer::Point const pt (x,y);
487 }
488 else if ( extension == "pgm" )
489 {
491 }
492
493#ifdef DGTAL_WITH_HDF5
494 if (extension=="h5")
496#endif
497
498 trace.error() << "Extension " << extension<< " not yet implemented in DGtal GenericReader." << std::endl;
499 throw dgtalio;
500
501 }
static ImageContainer importHDF5(const std::string &aFilename, const std::string &aDataset, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
static ImageContainer importRaw8(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())

References DGtal::GenericReader< TContainer, Tdim, TValue >::BOOST_CONCEPT_ASSERT(), DGtal::HDF5Reader< TImageContainer, TFunctor >::importHDF5(), DGtal::PGMReader< TImageContainer, TFunctor >::importPGM(), DGtal::RawReader< TImageContainer, TFunctor >::importRaw8(), and DGtal::trace.


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