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::TRBFileIO Class Reference

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

#include <btkTRBFileIO.h>

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

Public Types

typedef btkSharedPtr< const
TRBFileIO
ConstPointer
 
typedef btkSharedPtr< TRBFileIOPointer
 
- 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 void Read (const std::string &filename, Acquisition::Pointer output)
 
- Public Member Functions inherited from btk::AcquisitionFileIO
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 ExtensionsGetSupportedExtensions () const =0
 
bool HasInternalsUpdateOption (int option) const
 
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 Pointer New ()
 
- Static Public Member Functions inherited from btk::AcquisitionFileIO
static bool HasReadOperation ()
 
static bool HasWriteOperation ()
 

Protected Member Functions

 TRBFileIO ()
 
- 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 TRB files.

A TRB file contains markers trajectories 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 as the data part.

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 structure of the file can be summarized as the following:

* // Header
* 0x0000 0000 FFFF FFFF // Begin Header
* 0xXXXX XXXX // Address for the data part
* 0x0101 ...
* 0x0102 ...
* 0x0103 ...
* 0x0104 ...
* 0x0105 ...
* 0x0115 ...
* 0x010C ...
* |- // repeated by the number of markers
* 0x010C ...
* 0x010D ...
* |- // repeated by the number of links
* 0x010D ...
* // Data
* 0x0000 0600 0000 0000
* |- // repeated by the number of frames
* 0x0000 0600 ... 0000 0000
*

The TRB file format is created by Motion Analysis Corp.

Member Typedef Documentation

Smart pointer associated with a const TRBFileIO object.

Smart pointer associated with a TRBFileIO object.

Constructor & Destructor Documentation

btk::TRBFileIO::TRBFileIO ( )
protected

Constructor.

Member Function Documentation

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

Checks if the four first words are 0x0000 0000 FFFF FFFF

Implements btk::AcquisitionFileIO.

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

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

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

Read the file designated by filename and fill output.

Implements btk::AcquisitionFileIO.