DGtal  0.9.3beta
Public Member Functions | Static Public Member Functions
DGtal::GenericReader< TContainer, 3, DGtal::uint32_t > 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>
struct DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >

GenericReader Template partial specialisation for volume images with 32 bits values

Definition at line 212 of file GenericReader.h.

Member Function Documentation

template<typename TContainer >
DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TContainer >)  )
template<typename TContainer >
static TContainer DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >::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 >
template<typename TFunctor >
static TContainer DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >::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 > ).
xspecify the x image size to be used with raw format.
yspecify the y image size to be used with raw format.
zspecify the " image size to be used with raw format.

Definition at line 245 of file GenericReader.h.

References DGtal::GenericReader< TContainer, Tdim, TValue >::BOOST_CONCEPT_ASSERT(), DGtal::Trace::error(), DGtal::DicomReader< TImageContainer, TFunctor >::importDicom(), DGtal::ITKReader< TImage, TFunctor >::importITK(), DGtal::LongvolReader< TImageContainer, TFunctor >::importLongvol(), DGtal::RawReader< TImageContainer, TFunctor >::importRaw32(), and DGtal::trace.

249  {
250  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, DGtal::uint32_t, typename TContainer::Value > )) ;
251  DGtal::IOException dgtalio;
252  const std::string extension = filename.substr( filename.find_last_of(".") + 1 );
253 
254  if ( extension == "longvol" )
255  {
256  return LongvolReader<TContainer, TFunctor>::importLongvol( filename, aFunctor );
257  }
258  else if ( extension == "raw" )
259  {
260  ASSERT( x != 0 && y != 0 && z != 0 );
261  typename TContainer::Point const pt (x, y, z);
262  return RawReader< TContainer, TFunctor >::importRaw32 ( filename, pt, aFunctor );
263  }
264 
265 #ifdef WITH_ITK
266  if ( extension == "dcm" )
267  {
268  return DicomReader<TContainer, TFunctor>::importDicom(filename, aFunctor);
269  }
270  else if ( extension == "mha" || extension == "mhd" )
271  {
272  return ITKReader<TContainer, TFunctor>::importITK(filename, aFunctor);
273  }
274 #endif
275 
276  trace.error() << "Extension " << extension<< " not yet implemented in DGtal GenericReader." << std::endl;
277  throw dgtalio;
278  }
Trace trace
Definition: Common.h:137
static ImageContainer importDicom(const std::string &aFilename, const Functor &aFunctor=Functor())
BOOST_CONCEPT_ASSERT((concepts::CImage< TContainer >))
static ImageContainer importLongvol(const std::string &filename, const Functor &aFunctor=Functor())
static ImageContainer importRaw32(const std::string &filename, const Vector &extent, const Functor &aFunctor=Functor())
static Image importITK(const std::string &filename, const Functor &aFunctor=Functor())
std::ostream & error()

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