BTK  0.3dev.0
Open-source library to visualize/process biomechanical data
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
btk::ANBFileIO Class Reference

Interface to read/write ANB files. More...

#include <btkANBFileIO.h>

Inheritance diagram for btk::ANBFileIO:
Inheritance graph
[legend]

Public Types

typedef btkSharedPtr< const
ANBFileIO
ConstPointer
 
typedef btkSharedPtr< ANBFileIOPointer
 
- 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 ExtensionsGetSupportedExtensions () 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 ()
 

Protected Member Functions

 ANBFileIO ()
 
- Protected Member Functions inherited from btk::MotionAnalysisBinaryFileIO
void CheckSizeForSingleValue (IEEELittleEndianBinaryFileStream *bifs) const
 
 MotionAnalysisBinaryFileIO (StorageFormat s=StorageNotApplicable)
 
void ReadKey (IEEELittleEndianBinaryFileStream *bifs, int key) const
 
size_t ReadKeyValueFloat (float *val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueString (std::string &val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueU16 (uint16_t *val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueU16 (std::vector< uint16_t > &val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueU32 (uint32_t *val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueU8 (uint8_t *val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t ReadKeyValueU8 (std::vector< uint8_t > &val, IEEELittleEndianBinaryFileStream *bifs, int key)
 
size_t WriteKeyValue (IEEELittleEndianBinaryFileStream *bofs, uint16_t key, const std::vector< uint8_t > &val)
 
size_t WriteKeyValue (IEEELittleEndianBinaryFileStream *bofs, uint16_t key, const std::vector< uint16_t > &val)
 
size_t WriteKeyValue (IEEELittleEndianBinaryFileStream *bofs, uint16_t key, uint32_t val)
 
size_t WriteKeyValue (IEEELittleEndianBinaryFileStream *bofs, uint16_t key, float val)
 
size_t WriteKeyValue (IEEELittleEndianBinaryFileStream *bofs, uint16_t key, const std::string &val, bool spacing=false)
 
- Protected Member Functions inherited from btk::AcquisitionFileIO
 AcquisitionFileIO (FileType f=TypeNotApplicable, ByteOrder b=OrderNotApplicable, StorageFormat s=StorageNotApplicable, int internalsUpdate=UpdateNotApplicable)
 
void SetFileType (FileType f)
 
virtual ~AcquisitionFileIO ()
 

Additional Inherited Members

- Protected Attributes inherited from btk::AcquisitionFileIO
ByteOrder m_ByteOrder
 
FileType m_FileType
 
int m_InternalsUpdate
 
StorageFormat m_StorageFormat
 

Detailed Description

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:

A 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:

* 0x0000 0000 // Begin Header
* 0x8000 ...
* 0x0101 ...
* 0x0108 ...
* 0x0109 ...
* 0x010A ...
* 0x0102 ...
* 0x0103 ...
* 0x0104 ...
* 0x0105 ...
* 0x0106 ...
* 0x0107 ...
* |- // repeated by the number of channels
* 0x0107 ...
* 0x0000 0000 // End Header / Begin Data
* 0x8100 ...
* // ... scaled data ...
*

The ANB file format is created by Motion Analysis Corp.

Member Typedef Documentation

Smart pointer associated with a const ANBFileIO object.

Smart pointer associated with a ANBFileIO object.

Constructor & Destructor Documentation

btk::ANBFileIO::ANBFileIO ( )
protected

Constructor.

Member Function Documentation

bool btk::ANBFileIO::CanReadFile ( const std::string &  filename)
virtual

Checks if the first word in the file corresponds to "PathFileType".

Implements btk::AcquisitionFileIO.

bool btk::ANBFileIO::CanWriteFile ( const std::string &  filename)
virtual

Checks if the suffix of filename is ANB.

Implements btk::AcquisitionFileIO.

static ANBFileIO::Pointer btk::ANBFileIO::New ( )
inlinestatic

Create a ANBFileIO object an return it as a smart pointer.

void btk::ANBFileIO::Read ( const std::string &  filename,
Acquisition::Pointer  output 
)
virtual

Read the file designated by filename and fill output.

Implements btk::AcquisitionFileIO.

void btk::ANBFileIO::Write ( const std::string &  filename,
Acquisition::Pointer  input 
)
virtual

Write the file designated by filename with the content of input.

Implements btk::AcquisitionFileIO.