aimsdata
5.1.2
Neuroimaging data handling
|
Generic reader for every format of Aims object. More...
#include <aims/io/reader.h>
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::Object & | options () |
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 |
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, ...))
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.
aims::Reader< T >::Reader |
Definition at line 67 of file reader_d.h.
aims::Reader< T >::Reader | ( | const std::string & | filename | ) |
Definition at line 72 of file reader_d.h.
|
inlinevirtual |
const carto::AllocatorContext & aims::Reader< T >::allocatorContext |
Definition at line 112 of file reader_d.h.
|
static |
|
inline |
get input file name
Definition at line 102 of file reader.h.
References aims::Reader< T >::_filename.
carto::Object & aims::Reader< T >::options |
Definition at line 136 of file reader_d.h.
carto::Object aims::Reader< T >::options |
Definition at line 130 of file reader_d.h.
|
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 451 of file reader_d.h.
References carto::FileUtil::extension(), aims::FileFormatDictionary< T >::extensions(), aims::FileFormatDictionary< T >::fileFormat(), carto::getObjectHeader(), carto::const_ref< class >::isNull(), carto::io_error::keepExceptionPriority(), carto::io_error::launchExcept(), localMsg, carto::none(), aims::Finder::postProcessHeader(), aims::FileFormat< T >::read(), soma::Reader< class >::read(), carto::Object::reference(), soma::Reader< class >::setAllocatorContext(), soma::Reader< class >::setOptions(), aims::Settings::settings(), carto::toString(), carto::FileUtil::uriFilename(), carto::FileUtil::uriOptions(), and carto::Object::value().
|
virtual |
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.
DON'T USE SINGLE FRAME READING WITH MEMORY MAPPING !
Definition at line 142 of file reader_d.h.
References carto::FileUtil::basename(), aims::FileFormatDictionary< T >::extensions(), aims::FileFormatDictionary< T >::fileFormat(), carto::getObjectHeader(), carto::const_ref< class >::isNull(), carto::io_error::keepExceptionPriority(), carto::io_error::launchExcept(), localMsg, carto::none(), aims::Finder::postProcessHeader(), aims::FileFormat< T >::read(), soma::Reader< class >::read(), carto::Object::reference(), soma::Reader< class >::setAllocatorContext(), soma::Reader< class >::setOptions(), aims::Settings::settings(), carto::toString(), carto::FileUtil::uriFilename(), carto::FileUtil::uriOptions(), and carto::Object::value().
Referenced by aims::MaskIteratorOf< carto::VolumeRef< T > >::MaskIteratorOf(), operator>>(), aims::VolumeFormat< T >::read(), aims::AimsGraphReader::read(), aims::ReaderAsObject::readAsObject(), and aims::RoiIteratorOf< carto::VolumeRef< T > >::RoiIteratorOf().
void aims::Reader< T >::setAllocatorContext | ( | const carto::AllocatorContext & | ac | ) |
allocator control (not used by every format yet)
Definition at line 106 of file reader_d.h.
Referenced by aims::VolumeFormat< T >::read().
void aims::Reader< T >::setFileName | ( | const std::string & | fileName | ) |
set input file name
Definition at line 118 of file reader_d.h.
void aims::Reader< T >::setMode | ( | carto::AllocatorStrategy::MappingMode | mode | ) |
set input file mode - soon obsolete
Definition at line 79 of file reader_d.h.
void aims::Reader< T >::setOptions | ( | carto::Object | options | ) |
Definition at line 124 of file reader_d.h.
Referenced by aims::VolumeFormat< T >::read().
|
protected |
|
protected |
Definition at line 110 of file reader.h.
Referenced by aims::Reader< T >::fileName().
|
protected |
|
protected |