BTK
0.3dev.0
Open-source library to visualize/process biomechanical data
|
Interface to read/write acquisition's files. More...
#include <btkAcquisitionFileIO.h>
Classes | |
class | Extension |
Native extension used with an acquisition file IO. More... | |
class | Extensions |
List of AcquisitionFileIO::Extension object. More... | |
Public Types | |
enum | ByteOrder { OrderNotApplicable = 0, IEEE_LittleEndian, VAX_LittleEndian, IEEE_BigEndian } |
typedef btkSharedPtr< const AcquisitionFileIO > | ConstPointer |
enum | FileType { TypeNotApplicable, ASCII, Binary } |
enum | InternalsUpdateOption { UpdateNotApplicable = 0, NoUpdate = UpdateNotApplicable, DataBasedUpdate = 1, MetaDataBasedUpdate = 2, FileFormatOption = 512 } |
typedef btkSharedPtr < AcquisitionFileIO > | Pointer |
enum | StorageFormat { StorageNotApplicable = 0, Float = -1, Integer = 1 } |
Public Member Functions | |
virtual bool | CanReadFile (const std::string &filename)=0 |
virtual bool | CanWriteFile (const std::string &filename)=0 |
ByteOrder | GetByteOrder () const |
std::string | GetByteOrderAsString () const |
FileType | GetFileType () const |
int | GetInternalsUpdateOptions () const |
StorageFormat | GetStorageFormat () const |
std::string | GetStorageFormatAsString () const |
virtual const Extensions & | GetSupportedExtensions () const =0 |
bool | HasInternalsUpdateOption (int option) const |
virtual void | Read (const std::string &filename, Acquisition::Pointer output)=0 |
void | SetByteOrder (ByteOrder b) |
void | SetInternalsUpdateOptions (int options) |
void | SetStorageFormat (StorageFormat s) |
virtual void | Write (const std::string &filename, Acquisition::Pointer input)=0 |
Static Public Member Functions | |
static bool | HasReadOperation () |
static bool | HasWriteOperation () |
Protected Member Functions | |
AcquisitionFileIO (FileType f=TypeNotApplicable, ByteOrder b=OrderNotApplicable, StorageFormat s=StorageNotApplicable, int internalsUpdate=UpdateNotApplicable) | |
void | SetFileType (FileType f) |
virtual | ~AcquisitionFileIO () |
Protected Attributes | |
ByteOrder | m_ByteOrder |
FileType | m_FileType |
int | m_InternalsUpdate |
StorageFormat | m_StorageFormat |
Interface to read/write acquisition's files.
A class inheriting from AcquisitionFileIO has to implement 4 methods:
To help developers, some macros were defined in case:
These macros should be used at the top of the declaration of the new class. For example:
In this example, the FooFileIO class can only read files, and the default file extension known is "FOO".
After the implementation of the new IO, you can decide to add it to the factory (using the method AcquisitionFileIOFactory::AddFileIO). This will give the possibility to select the new IO automatically based on the return value of the method CanReadFile() or CanWriteFile().
For inheriting classes which implement the Write() method, it is possible to select the way the internal configuration (if any) is updated based on the acquisiton input. By default, the internal member m_InternalsUpdate is set to AcquisitionFileIO::UpdateNotApplicable. Two other choices are proposed to update the internal: based on data (points, analog channels, events) (AcquisitionFileIO::DataBasedUpdate) or based on metadata (AcquisitionFileIO::MetaDataBasedUpdate). These options are only informative and it is up to each file format to use this information of not. It is also possible to extend the options used to update each file format internals by using the enum value AcquisitionFileIO::FileFormatOption. For example, the C3D file format has an option (C3DFileIO::CompatibleVicon = AcquisitionFileIO::FileFormatOption) to keep generated file compatible with the software Polygon (Vicon, version 3.5) which crash if some parameters' description is empty.
Smart pointer associated with a const AcquisitionFileIO object.
Smart pointer associated with an AcquisitionFileIO object.
Enums used to specify the byte order of the file (integer and float).
Enums used to specify the update of the internal configuration of a file format (if any)
Enumerator | |
---|---|
UpdateNotApplicable |
No update is done and existing internals are used. |
NoUpdate | |
DataBasedUpdate |
Internals are updated using acquisition data (points, analog channels, events). |
MetaDataBasedUpdate |
Internals are updated using acquisition metadata. |
FileFormatOption |
Extension for specific file format extension. It is important to distinguish each new option by multiplying by 2-based integer (i.e. 2, 4, 8, 16, etc.). * enum {MyFirstOption = AcquisitionFileIO::FileFormatOption, MySecondOption = 2*AcquisitionFileIO::FileFormatOption};
*
|
Enums used to specify the format of the stored data.
Enumerator | |
---|---|
StorageNotApplicable |
Acquisition's data have no storage format. |
Float |
Acquisition's data are stored as float values. |
Integer |
Acquisition's data are stored as integer values. |
|
protected |
Constructor.
|
inlineprotectedvirtual |
Empty destructor.
|
pure virtual |
Checks if filename can be read by this AcquisitionFileIO. This methods should try to read the file header instead to check the file's suffix.
Implemented in btk::C3DFileIO, btk::BSFFileIO, btk::TDFFileIO, btk::AMTIForcePlatformFileIO, btk::CALForcePlateFileIO, btk::ANGFileIO, btk::CLBFileIO, btk::DelsysEMGFileIO, btk::EMFFileIO, btk::EMxFileIO, btk::GRxFileIO, btk::KistlerDATFileIO, btk::MDFFileIO, btk::MOMFileIO, btk::PWRFileIO, btk::RAxFileIO, btk::RICFileIO, btk::TRBFileIO, btk::XLSOrthoTrakFileIO, btk::XMOVEFileIO, btk::ANBFileIO, btk::ANCFileIO, and btk::TRCFileIO.
|
pure virtual |
Checks if filename can be write by this AcquisitionFileIO. This method should try to determine if the file's suffix corresponds to one of the supported file's suffixes by this AcquisitionFileIO.
Implemented in btk::C3DFileIO, btk::CALForcePlateFileIO, btk::ANBFileIO, btk::ANCFileIO, and btk::TRCFileIO.
|
inline |
Gets the byte order of the file (only for binary file).
std::string btk::AcquisitionFileIO::GetByteOrderAsString | ( | ) | const |
Gets the byte order as a string.
|
inline |
Gets the type of the file.
|
inline |
Returns the option(s) used to update internals.
|
inline |
Returns the format used to store points and analog channels.
std::string btk::AcquisitionFileIO::GetStorageFormatAsString | ( | ) | const |
Gets the storage format as a string.
|
pure virtual |
Return the suppored extensions by this file IO.
|
inline |
Returns true if the given option is used or false if not.
|
inlinestatic |
Returns the property of this acquisition file IO to read data from a file and extract data.
|
inlinestatic |
Returns the property of this acquisition file IO to read data from a file and extract data.
|
pure virtual |
Read the file designated by filename and fill output.
Implemented in btk::C3DFileIO, btk::BSFFileIO, btk::TDFFileIO, btk::AMTIForcePlatformFileIO, btk::CALForcePlateFileIO, btk::ANBFileIO, btk::ANCFileIO, btk::ANGFileIO, btk::CLBFileIO, btk::DelsysEMGFileIO, btk::EMFFileIO, btk::EMxFileIO, btk::GRxFileIO, btk::KistlerDATFileIO, btk::MDFFileIO, btk::MOMFileIO, btk::PWRFileIO, btk::RAxFileIO, btk::RICFileIO, btk::TRBFileIO, btk::TRCFileIO, btk::XLSOrthoTrakFileIO, and btk::XMOVEFileIO.
|
inline |
Sets the byte order of the file (only for binary file).
|
inlineprotected |
Sets the type of the file. This method is protected because some file can be only ASCII file or binary file. An inherited class can use this method as public with using
AcquisitionFileIO::SetFileType
; in its public part.
|
inline |
Sets the option(s) used to update internals.
|
inline |
Sets the format used to store points and analog channels.
|
pure virtual |
Write the file designated by filename with the content of input.
Implemented in btk::C3DFileIO, btk::CALForcePlateFileIO, btk::ANBFileIO, btk::ANCFileIO, and btk::TRCFileIO.
|
protected |
Byte order.
|
protected |
File type.
|
protected |
Configuration used to update file format internals when an acquisition is writed.
|
protected |
Storage format.