BTK
0.3dev.0
Open-source library to visualize/process biomechanical data
|
Interface to read/write ANB files. More...
#include <btkANBFileIO.h>
Public Types | |
typedef btkSharedPtr< const ANBFileIO > | ConstPointer |
typedef btkSharedPtr< ANBFileIO > | Pointer |
Public Types inherited from btk::AcquisitionFileIO | |
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) |
virtual bool | CanWriteFile (const std::string &filename) |
virtual void | Read (const std::string &filename, Acquisition::Pointer output) |
virtual void | Write (const std::string &filename, Acquisition::Pointer input) |
Public Member Functions inherited from btk::AcquisitionFileIO | |
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 |
void | SetByteOrder (ByteOrder b) |
void | SetInternalsUpdateOptions (int options) |
void | SetStorageFormat (StorageFormat s) |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from btk::AcquisitionFileIO | |
static bool | HasReadOperation () |
static bool | HasWriteOperation () |
Additional Inherited Members | |
Protected Attributes inherited from btk::AcquisitionFileIO | |
ByteOrder | m_ByteOrder |
FileType | m_FileType |
int | m_InternalsUpdate |
StorageFormat | m_StorageFormat |
Interface to read/write ANB files.
A ANB file contains analog channels data stored in the IEEE Little endian binary format.
Based on reverse engineering, the file format is composed of a header part and a data part. The header is composed of keys and values.
The known keys are:
0x8000
: Number of words for the header0x0101
: ID?0x0108
: Board Type0x0109
: Bit Depth0x010A
: Precise Rate0x0102
: Channel Number0x0103
: Channel Index? (use a decimal to binary converter to found the index 0xFF = 0b11111111)0x0104
: Channel Rate0x0105
: First time? (index of the first frame)?0x0106
: Channel Range (each range is write on 2 bytes)0x0107
: Channel Label (if label's size % 4 == 0, then add a word of 0x00)0x8100
: Number of words for the dataA key is always followed by the size of its value and is write on 2 bytes. The size correspond to number of word associated with the key. A word corresponds to four bytes. For example, the following string:
0800 0001 0000 024C
corresponds to the key 0x0800
with a size of 1 word (0x0001
) and a value equal to 588 (0x024C
).
The number of frames is determined as number_of_frames = (number_of_words - 3) * 2 / number_of_channels
The structure of the file can be summarized as the following:
The ANB file format is created by Motion Analysis Corp.
Smart pointer associated with a const ANBFileIO object.
Smart pointer associated with a ANBFileIO object.
|
protected |
Constructor.
|
virtual |
Checks if the first word in the file corresponds to "PathFileType".
Implements btk::AcquisitionFileIO.
|
virtual |
Checks if the suffix of filename is ANB.
Implements btk::AcquisitionFileIO.
|
inlinestatic |
Create a ANBFileIO object an return it as a smart pointer.
|
virtual |
Read the file designated by filename and fill output.
Implements btk::AcquisitionFileIO.
|
virtual |
Write the file designated by filename with the content of input.
Implements btk::AcquisitionFileIO.