DGtal  0.9.4beta
Public Member Functions | Static Public Member Functions
DGtal::GenericReader< TContainer, 3, TValue > Struct Template Reference

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

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, unsigned int z=0) throw (DGtal::IOException)
 
template<typename TFunctor >
static TContainer importWithValueFunctor (const std::string &filename, const TFunctor &aFunctor, unsigned int x=0, unsigned int y=0, unsigned int z=0) throw ( DGtal::IOException )
 

Detailed Description

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

GenericReader Template partial specialisation for volume images of dimension 3

Definition at line 214 of file GenericReader.h.

Member Function Documentation

template<typename TContainer , typename TValue >
DGtal::GenericReader< TContainer, 3, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TContainer >)  )
template<typename TContainer , typename TValue >
static TContainer DGtal::GenericReader< TContainer, 3, TValue >::import ( const std::string &  filename,
unsigned int  x = 0,
unsigned int  y = 0,
unsigned int  z = 0 
)
throw (DGtal::IOException
)
static

Import a volume image file. For the special format of raw image, the default parameter x,y, z need to be updated according to the dimension if the image.

Parameters
filenamethe image filename to be imported.
xthe size in the x direction.
ythe size in the y direction.
zthe size in the z direction.
template<typename TContainer , typename TValue >
template<typename TFunctor >
static TContainer DGtal::GenericReader< TContainer, 3, TValue >::importWithValueFunctor ( const std::string &  filename,
const TFunctor &  aFunctor,
unsigned int  x = 0,
unsigned int  y = 0,
unsigned int  z = 0 
)
throw (DGtal::IOException
)
inlinestatic

Import an image file by specifying a value functor (used for gray scale image format: vol, longvol, pgm3D, raw).

Template Parameters
TFunctorThe type of the functor (should verify the concept CUnaryFunctor<TFunctor, unsigned char , TContainer::Value > ).
Parameters
filenamethe image filename to be imported.
aFunctoran ColorRGBEncoder. The type of the functor (should verify the concept CUnaryFunctor<TFunctor, TContainer::Value, DGtal::Color > ).
xx
yy
zz

Definition at line 247 of file GenericReader.h.

References DGtal::GenericReader< TContainer, Tdim, TValue >::BOOST_CONCEPT_ASSERT(), DGtal::Trace::error(), DGtal::DicomReader< TImageContainer, TFunctor >::importDicom(), DGtal::HDF5Reader< TImageContainer, TFunctor >::importHDF5_3D(), DGtal::ITKReader< TImage >::importITK(), DGtal::LongvolReader< TImageContainer, TFunctor >::importLongvol(), DGtal::PGMReader< TImageContainer, TFunctor >::importPGM3D(), DGtal::VolReader< TImageContainer, TFunctor >::importVol(), and DGtal::trace.

251  {
252  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, unsigned char, typename TContainer::Value > )) ;
253  DGtal::IOException dgtalio;
254  const std::string extension = filename.substr(filename.find_last_of(".") + 1);
255 
256  if ( extension == "vol" )
257  {
258  return VolReader<TContainer, TFunctor>::importVol( filename, aFunctor );
259  }
260  else if ( extension == "longvol" )
261  {
262  return LongvolReader<TContainer, TFunctor>::importLongvol( filename, aFunctor );
263  }
264  else if ( extension == "pgm3d" || extension == "pgm3D" || extension == "p3d" || extension == "pgm" )
265  {
266  return PGMReader<TContainer, TFunctor>::importPGM3D(filename, aFunctor);
267  }
268  else if ( extension == "raw" )
269  {
270  ASSERT( x != 0 && y != 0 && z != 0 );
271  typename TContainer::Point const pt (x, y, z);
272  return RawReader< TContainer, TFunctor >::template importRaw<TValue>( filename, pt, aFunctor );
273  }
274 
275 #ifdef WITH_HDF5
276  if ( extension == "h5" )
277  return HDF5Reader<TContainer, TFunctor>::importHDF5_3D(filename, "UInt8Array3D", aFunctor);
278 #endif
279 
280 #ifdef WITH_ITK
281  if ( extension == "dcm" )
282  {
283  return DicomReader<TContainer, TFunctor>::importDicom(filename, aFunctor);
284  }
285  else if ( extension == "nii" || extension == "mha" ||
286  extension == "mhd" || extension == "tiff" ||
287  extension == "tif" )
288  {
289  return ITKReader<TContainer>::importITK( filename, aFunctor );
290  }
291 #endif
292 
293  trace.error() << "Extension " << extension<< " in 3D, not yet implemented in DGtal GenericReader." << std::endl;
294  throw dgtalio;
295  }
Trace trace
Definition: Common.h:137
static ImageContainer importDicom(const std::string &aFilename, const Functor &aFunctor=Functor())
static Image importITK(const std::string &filename, const TFunctor &aFunctor=TFunctor())
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
BOOST_CONCEPT_ASSERT((concepts::CImage< TContainer >))
static ImageContainer importLongvol(const std::string &filename, const Functor &aFunctor=Functor())
static ImageContainer importHDF5_3D(const std::string &aFilename, const std::string &aDataset, const Functor &aFunctor=Functor())
static ImageContainer importPGM3D(const std::string &aFilename, const Functor &aFunctor=Functor())
std::ostream & error()

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