aimsdata
5.0.5
Neuroimaging data handling
|
Generic finder / checker for all data objects and file formats This will replace the old AimsFinder. More...
#include <aims/io/finder.h>
Public Types | |
enum | State { Unchecked, Ok, Error } |
Public Member Functions | |
Finder () | |
~Finder () | |
bool | check (const std::string &filename) |
Determines object associated to file name and returns true if success. More... | |
std::string | objectType () const |
void | setObjectType (const std::string &obj) |
std::string | dataType () const |
void | setDataType (const std::string &dat) |
std::vector< std::string > | possibleDataTypes () const |
void | setPossibleDataTypes (const std::vector< std::string > &dt) |
std::string | format () const |
void | setFormat (const std::string &fmt) |
const Header * | header () const |
void | setHeader (Header *hdr) |
carto::Object | headerObject () const |
void | setHeader (carto::Object hdr) |
State | state () const |
std::string | errorMessage () const |
void | launchException () |
creates and throws an exception corresponding to the error state More... | |
Static Public Member Functions | |
static void | registerFormat (const std::string &fmtid, FinderFormat *format, const std::vector< std::string > &extensions, const std::string &before="") |
static FinderFormat * | finderFormat (const std::string &format) |
Finds the FinderFormat associated with the given string ID. More... | |
static void | unregisterFormat (const std::string &format) |
static void | postProcessHeader (carto::Object hdr) |
static std::set< std::string > | extensions (const std::string &format) |
show the set of official extensions for a given format More... | |
Generic finder / checker for all data objects and file formats This will replace the old AimsFinder.
Warning: Finder will be replaced by carto::DataSourceInfo in cartobase library. Avoid using it in new code.
The Finder provides a plug-in system for new formats and data types. Formats are hidden in the plugins and should never be accessed directly.
Usage: check() the file and then process according to the object type ("Volume", "Mesh", "Texture", "Bucket", ...) and its data type (if any) ("S16" : short, "U8": unsigned byte, "FLOAT", "DOUBLE", ...)
Use the generic Reader once the data type is known, the right format will be selected automatically.
Avoiding manually switching on objects and data types is now possible using the new Process interface and presumably, template functions.
See the AimsFileInfo command for an example of how to use it.
Here is an example of using the Finder class:
enum aims::Finder::State |
aims::Finder::Finder | ( | ) |
aims::Finder::~Finder | ( | ) |
bool aims::Finder::check | ( | const std::string & | filename | ) |
Determines object associated to file name and returns true if success.
If successful, appropriate infos are stored into the Finder, including the full format header
|
inline |
Definition at line 143 of file finder.h.
Referenced by aims::AimsGraphReader::read().
|
static |
show the set of official extensions for a given format
|
static |
Finds the FinderFormat associated with the given string ID.
const Header* aims::Finder::header | ( | ) | const |
|
inline |
void aims::Finder::launchException | ( | ) |
creates and throws an exception corresponding to the error state
|
inline |
Definition at line 141 of file finder.h.
Referenced by aims::AimsGraphReader::read().
|
inline |
Some formats (like VIDA and ECAT) can be read as different data types for the same file (for ex. if using shorts resampled for each slice). By asking all the possible data types you can choose the one you prefer for your application. Possible types may be sorted by preference.
|
static |
|
static |
|
inline |
|
inline |
void aims::Finder::setHeader | ( | Header * | hdr | ) |
void aims::Finder::setHeader | ( | carto::Object | hdr | ) |
|
inline |
|
inline |
|
static |