DGtal  0.9.4beta
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Static Private Member Functions | Static Private Attributes
DGtal::LongvolReader< TImageContainer, TFunctor > Struct Template Reference

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

Data Structures

struct  HeaderField
 

Public Types

typedef TImageContainer ImageContainer
 
typedef TImageContainer::Value Value
 
typedef TFunctor Functor
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CUnaryFunctor< TFunctor, DGtal::uint64_t, Value >))
 
 BOOST_STATIC_ASSERT (ImageContainer::Domain::dimension==3)
 

Static Public Member Functions

static ImageContainer importLongvol (const std::string &filename, const Functor &aFunctor=Functor())
 

Private Types

typedef unsigned char voxel
 

Static Private Member Functions

template<typename Word >
static std::stringstream & read_word (std::stringstream &fin, Word &aValue)
 
static const char * getHeaderValue (const char *type, const HeaderField *header)
 
static int getHeaderValueAsInt (const char *type, int *dest, const HeaderField *header)
 
static int getHeaderField (const char *type, const HeaderField *header)
 

Static Private Attributes

static const char * requiredHeaders []
 

Detailed Description

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

Aim: implements methods to read a "Longvol" file format (with DGtal::uint64_t value type).

Description of template class 'LongvolReader'

The main import method "importLongvol" returns an instance of the template parameter TImageContainer.

The private methods have been backported from the Simplelvol project (see http://liris.cnrs.fr/david.coeurjolly).

Example usage:

...
#include <DGtal/helpers/StdDefs.h>
//Default image container = STLVector
typedef ImageSelector<Z3i::Domain, DGtal::uint64_t>::Type Image;
Image image = LongvolReader<Image>::importLongvol("data.longvol");
trace.info() << image <<endl;
...
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
testLongvol.cpp

Definition at line 91 of file LongvolReader.h.

Member Typedef Documentation

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

Definition at line 97 of file LongvolReader.h.

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

Definition at line 95 of file LongvolReader.h.

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

Definition at line 96 of file LongvolReader.h.

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
typedef unsigned char DGtal::LongvolReader< TImageContainer, TFunctor >::voxel
private

Definition at line 145 of file LongvolReader.h.

Member Function Documentation

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
DGtal::LongvolReader< TImageContainer, TFunctor >::BOOST_CONCEPT_ASSERT ( (concepts::CUnaryFunctor< TFunctor, DGtal::uint64_t, Value >)  )
template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
DGtal::LongvolReader< TImageContainer, TFunctor >::BOOST_STATIC_ASSERT ( ImageContainer::Domain::dimension  = =3)
template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static int DGtal::LongvolReader< TImageContainer, TFunctor >::getHeaderField ( const char *  type,
const HeaderField header 
)
staticprivate

Internal method which returns the index of a field or -1 if not found.

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static const char* DGtal::LongvolReader< TImageContainer, TFunctor >::getHeaderValue ( const char *  type,
const HeaderField header 
)
staticprivate

Returns NULL if this field is not found.

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
static int DGtal::LongvolReader< TImageContainer, TFunctor >::getHeaderValueAsInt ( const char *  type,
int *  dest,
const HeaderField header 
)
staticprivate

Returns non-zero if failure.

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

Main method to import a Longvol into an instance of the template parameter ImageContainer.

Parameters
filenamethe file name to import.
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 > .
Returns
an instance of the ImageContainer.

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

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
template<typename Word >
static std::stringstream& DGtal::LongvolReader< TImageContainer, TFunctor >::read_word ( std::stringstream &  fin,
Word &  aValue 
)
inlinestaticprivate

Generic read word (binary mode) in little-endian mode.

Parameters
fininput stream.
aValuevalue to write.
Returns
modified stream.

Definition at line 131 of file LongvolReader.h.

132  {
133  aValue = 0;
134  char c;
135  for (auto size = 0; size < sizeof( Word ); ++size)
136  {
137  fin.get( c ) ;
138  unsigned char cc=static_cast<unsigned char>(c);
139  aValue |= (cc << (8 * size));
140  }
141  return fin;
142  }

Field Documentation

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
const char* DGtal::LongvolReader< TImageContainer, TFunctor >::requiredHeaders[]
staticprivate

Global list of required fields in a .longvol file.

Definition at line 194 of file LongvolReader.h.


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