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.
template<typename TContainer , typename TValue >
template<typename TFunctor >
static 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
-
TFunctor | The type of the functor (should verify the concept CUnaryFunctor<TFunctor, TContainer::Value, DGtal::Color > ). |
- Parameters
-
filename | the image filename to be imported. |
aFunctor | an ColorRGBEncoder. The type of the functor (should verify the concept CUnaryFunctor<TFunctor, TContainer::Value, DGtal::Color > ). |
x | specify the x image size to be used with raw format. |
y | specify the y image size to be used with raw format. |
Definition at line 429 of file GenericReader.h.
434 BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, DGtal::Color, typename TContainer::Value> )) ;
437 const std::string extension = filename.substr( filename.find_last_of(
".") + 1 );
439 if ( extension ==
"ppm" )
443 else if ( extension ==
"raw" )
445 ASSERT( x != 0 && y != 0 );
447 return RawReader< TContainer, TFunctor >::template importRaw<DGtal::Color>( filename, pt, aFunctor);
449 else if ( extension ==
"gif" || extension ==
"jpg" || extension ==
"png" || extension ==
"jpeg" || extension ==
"bmp" || extension ==
"tga" )
451 STBReader<TContainer, TFunctor> reader;
452 return reader.import( filename, aFunctor );
455 trace.
error() <<
"Extension " << extension<<
" in 2D, not yet implemented in DGtal GenericReader." << std::endl;
BOOST_CONCEPT_ASSERT((concepts::CImage< TContainer >))
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::Trace::error(), DGtal::STBReader< TImageContainer, TFunctor >::import(), DGtal::PPMReader< TImageContainer, TFunctor >::importPPM(), and DGtal::trace.
template<typename TContainer , typename TValue >
template<typename TFunctor >
static 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
-
TFunctor | The type of the functor (should verify the concept CUnaryFunctor<TFunctor, unsigned char, TContainer::Value > ). |
- Parameters
-
filename | the image filename to be imported. |
aFunctor | to transform input unsigned char of image value into the given image type. image. |
x | specify the x image size to be used with raw format. |
y | specify the y image size to be used with raw format. |
Definition at line 472 of file GenericReader.h.
476 BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, unsigned char, typename TContainer::Value > )) ;
480 const std::string extension = filename.substr( filename.find_last_of(
".") + 1 );
482 if ( extension ==
"raw" )
484 ASSERT( x!= 0 && y != 0);
488 else if ( extension ==
"pgm" )
498 trace.
error() <<
"Extension " << extension<<
" not yet implemented in DGtal GenericReader." << std::endl;
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::Trace::error(), DGtal::HDF5Reader< TImageContainer, TFunctor >::importHDF5(), DGtal::PGMReader< TImageContainer, TFunctor >::importPGM(), DGtal::RawReader< TImageContainer, TFunctor >::importRaw8(), and DGtal::trace.