A.I.M.S


aims::Reader< T > Class Template Reference

Generic reader for every format of Aims object. More...

#include <aims/io/reader.h>

Inheritance diagram for aims::Reader< T >:
Collaboration diagram for aims::Reader< T >:

Public Member Functions

 Reader ()
 
 Reader (const std::string &filename)
 
virtual ~Reader ()
 
virtual bool read (T &obj, int border=0, const std::string *format=0, int frame=-1)
 Finds the correct format and reads the object. if format is specified, this format is tried first, so you can use it as a hint if you already kow it (from the Finder check ). IF frame is specified and non-negative, reads only that frame (one temporal positon) of the file into time position zero of the object. More...
 
virtual T * read (int border=0, const std::string *format=0, int frame=-1)
 Creates and reads an object. This function differs from the read( T&, ... ) function in the way that it creates the object and does not just fill it. This enables to create sub-classes of T (factory-like behaviour) on types that allow subclasses. The object is created by new and can be deleted. The default implementation just creates a T and calls the read( T&, ... ) function. More...
 
void setMode (carto::AllocatorStrategy::MappingMode mode)
 set input file mode - soon obsolete More...
 
void setAllocatorContext (const carto::AllocatorContext &ac)
 allocator control (not used by every format yet) More...
 
const carto::AllocatorContext & allocatorContext () const
 
void setFileName (const std::string &fileName)
 set input file name More...
 
const std::string & fileName () const
 get input file name More...
 
void setOptions (carto::Object options)
 
carto::Object options () const
 
carto::Objectoptions ()
 

Static Public Member Functions

static std::string extension (const std::string &filename)
 

Protected Attributes

std::string _filename
 
carto::AllocatorStrategy::MappingMode _mode
 
carto::AllocatorContext _alloccontext
 
carto::Object _options
 

Detailed Description

template<class T>
class aims::Reader< T >

Generic reader for every format of Aims object.

Still a template class, the data type must be switched at upper-level (see Finder or Process). Generic readers offer a plug-in mechanism to allow new formats to be registered. It uses at lower level specific readers of each format (GisReader for GIS, AimsVidaReader for Vida, AimsSpmReader for SPM, AimsDicomReader for DICOM, AimsEcatReader for Ecat..., and readers for other object types (meshes, buckets, textures, ...))

Adding new readers

The standard Aims library includes a set of already compiled formats, using a FileFormatDictionary to provide a common link between Reader and Writer, see FileFormatDictionary for a list

If you need to use other types, you'll have to include aims/io/reader_d.h in order to have the template functions definitions, aims/io/reader.h is only the class declarations. In addition, you may want to specialize the registerBaseFormats() functions of the FileFormatDictionary classes.

See also
FileFormatDictionary Writer Finder Process

Definition at line 69 of file reader.h.

Constructor & Destructor Documentation

template<class T >
aims::Reader< T >::Reader ( )

Definition at line 62 of file reader_d.h.

template<class T >
aims::Reader< T >::Reader ( const std::string &  filename)

Definition at line 67 of file reader_d.h.

template<class T>
virtual aims::Reader< T >::~Reader ( )
inlinevirtual

Definition at line 74 of file reader.h.

Member Function Documentation

template<typename T >
const carto::AllocatorContext & aims::Reader< T >::allocatorContext ( ) const

Definition at line 107 of file reader_d.h.

template<class T>
static std::string aims::Reader< T >::extension ( const std::string &  filename)
static
template<class T>
const std::string& aims::Reader< T >::fileName ( ) const
inline

get input file name

Definition at line 102 of file reader.h.

template<class T >
carto::Object aims::Reader< T >::options ( ) const

Definition at line 125 of file reader_d.h.

template<class T >
carto::Object & aims::Reader< T >::options ( )

Definition at line 131 of file reader_d.h.

template<class T>
bool aims::Reader< T >::read ( T &  obj,
int  border = 0,
const std::string *  format = 0,
int  frame = -1 
)
virtual
template<class T>
T * aims::Reader< T >::read ( int  border = 0,
const std::string *  format = 0,
int  frame = -1 
)
virtual

Creates and reads an object. This function differs from the read( T&, ... ) function in the way that it creates the object and does not just fill it. This enables to create sub-classes of T (factory-like behaviour) on types that allow subclasses. The object is created by new and can be deleted. The default implementation just creates a T and calls the read( T&, ... ) function.

Definition at line 427 of file reader_d.h.

References aims::FileFormatDictionary< T >::extensions(), aims::FileFormatDictionary< T >::fileExtension(), aims::FileFormatDictionary< T >::fileFormat(), carto::getObjectHeader(), carto::DictionaryInterface::getProperty(), carto::GenericObject::getString(), carto::Object::isNull(), carto::none(), aims::Finder::postProcessHeader(), soma::Reader< T >::read(), aims::FileFormat< T >::read(), soma::Reader< T >::setAllocatorContext(), soma::Reader< T >::setOptions(), carto::DictionaryInterface::setProperty(), carto::toString(), and carto::Object::value().

template<typename T >
void aims::Reader< T >::setAllocatorContext ( const carto::AllocatorContext &  ac)

allocator control (not used by every format yet)

Definition at line 101 of file reader_d.h.

Referenced by aims::VolumeFormat< T >::read().

template<class T >
void aims::Reader< T >::setFileName ( const std::string &  fileName)

set input file name

Definition at line 113 of file reader_d.h.

template<class T >
void aims::Reader< T >::setMode ( carto::AllocatorStrategy::MappingMode  mode)

set input file mode - soon obsolete

Definition at line 74 of file reader_d.h.

References MAP.

template<class T >
void aims::Reader< T >::setOptions ( carto::Object  options)

Definition at line 119 of file reader_d.h.

Referenced by aims::VolumeFormat< T >::read().

Member Data Documentation

template<class T>
carto::AllocatorContext aims::Reader< T >::_alloccontext
protected

Definition at line 112 of file reader.h.

template<class T>
std::string aims::Reader< T >::_filename
protected

Definition at line 110 of file reader.h.

Referenced by aims::Reader< AimsData< int16_t > >::fileName().

template<class T>
carto::AllocatorStrategy::MappingMode aims::Reader< T >::_mode
protected

Definition at line 111 of file reader.h.

template<class T>
carto::Object aims::Reader< T >::_options
protected

Definition at line 113 of file reader.h.


The documentation for this class was generated from the following files: