DGtal  1.5.beta
DGtal::LongvolReader< TImageContainer, TFunctor > Struct Template Reference

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

#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)
 Returns NULL if this field is not found. More...
 
static int getHeaderValueAsInt (const char *type, int *dest, const HeaderField *header)
 Returns non-zero if failure. More...
 
static int getHeaderField (const char *type, const HeaderField *header)
 Internal method which returns the index of a field or -1 if not found. More...
 

Static Private Attributes

static const char * requiredHeaders []
 Global list of required fields in a .longvol file. More...
 

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
trace.info() << image <<endl;
...
std::ostream & info()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
ImageContainerBySTLVector< Domain, Value > Type
Definition: ImageSelector.h:78
static ImageContainer importLongvol(const std::string &filename, const Functor &aFunctor=Functor())
ImageContainerBySTLVector< Domain, Value > Image
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

◆ Functor

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.

◆ ImageContainer

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.

◆ Value

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.

◆ voxel

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

Definition at line 140 of file LongvolReader.h.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
DGtal::LongvolReader< TImageContainer, TFunctor >::BOOST_CONCEPT_ASSERT ( (concepts::CUnaryFunctor< TFunctor, DGtal::uint64_t, Value >)  )

◆ BOOST_STATIC_ASSERT()

template<typename TImageContainer , typename TFunctor = functors::Cast< typename TImageContainer::Value >>
DGtal::LongvolReader< TImageContainer, TFunctor >::BOOST_STATIC_ASSERT ( ImageContainer::Domain::dimension  = =3)

◆ getHeaderField()

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.

◆ getHeaderValue()

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.

◆ getHeaderValueAsInt()

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.

◆ importLongvol()

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().

◆ read_word()

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  char* raw = reinterpret_cast<char*>(&aValue);
134  for (std::size_t i = 0; i < sizeof(Word); ++i)
135  raw[i] = fin.get();
136  return fin;
137  }

Field Documentation

◆ requiredHeaders

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 189 of file LongvolReader.h.


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