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

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

#include <btkC3DFileIO.h>

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

Public Types

enum  { CompatibleVicon = AcquisitionFileIO::FileFormatOption }
 
enum  AnalogIntegerFormat { Signed, Unsigned }
 
typedef btkSharedPtr< const
C3DFileIO
ConstPointer
 
typedef btkSharedPtr< C3DFileIOPointer
 
- 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)
 
std::vector< double > & GetAnalogChannelScale ()
 
const std::vector< double > & GetAnalogChannelScale () const
 
AnalogIntegerFormat GetAnalogIntegerFormat () const
 
double GetAnalogUniversalScale () const
 
std::vector< int > & GetAnalogZeroOffset ()
 
const std::vector< int > & GetAnalogZeroOffset () const
 
double GetPointScale () const
 
virtual void Read (const std::string &filename, Acquisition::Pointer output)
 
void SetAnalogChannelScale (const std::vector< double > &s)
 
void SetAnalogIntegerFormat (AnalogIntegerFormat f)
 
void SetAnalogUniversalScale (double s)
 
void SetAnalogZeroOffset (const std::vector< int > &s)
 
void SetPointScale (double s)
 
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

 C3DFileIO ()
 
- 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 C3D files.

All the informations related to the acquisition are stored in the output object. Few data, like the byte order, the points' scale, the analog universal scale, the integer analog storage format are available as member of this class. These informations are extracted when a C3D file is read or can be filled/modified to write a new C3D file. All these members can be accessed or modified using dedicated methods.

Compared to the C3DServer API, all the data in BTK extracted from a C3D file are already scaled and available in the children of the output Acquisition. You don't need to access to the groups/parameters for that. However, if you have some custom parameters, then you can access them from the metadata stored in the output Acquisition using the method Acquisition::GetMetadata().

Moreover, there are specific options to create a C3D file from an acquisition:

To write a C3D file with a given processor architecture (called byte order in BTK), you have to use the method C3DFileIO::SetByteOrder().

For more informations on this file's format: http:://www.c3d.org

Member Typedef Documentation

Smart pointer associated with a const C3DFileIO object.

Smart pointer associated with a C3DFileIO object.

Member Enumeration Documentation

anonymous enum
Enumerator
CompatibleVicon 

Option to checks and updates (if necessary) acquisition parameters which can crash Vicon's product (Polygon, Workstation, Nexus).

Enums used to specify the format used to store analog's data.

Enumerator
Signed 

Analog's data are stored as signed integer values (by default).

Unsigned 

Analog's data are stored as unsigned integer values.

Constructor & Destructor Documentation

btk::C3DFileIO::C3DFileIO ( )
protected

Constructor.

Member Function Documentation

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

Checks if the first byte of the file corresponds to C3D header.

Implements btk::AcquisitionFileIO.

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

Checks if the suffix of filename is C3D.

Implements btk::AcquisitionFileIO.

std::vector< double > & btk::C3DFileIO::GetAnalogChannelScale ( )
inline

Returns the vector of scales used for the analog channels' scaling (parameter ANALOG:SCALE).

const std::vector< double > & btk::C3DFileIO::GetAnalogChannelScale ( ) const
inline

Returns the vector of scales used for the analog channels' scaling.

AnalogIntegerFormat btk::C3DFileIO::GetAnalogIntegerFormat ( ) const
inline

Return the integer format (signed/unsigned).

double btk::C3DFileIO::GetAnalogUniversalScale ( ) const
inline

Returns the universal scale factor used to scale analog channels (parameter ANALOG:GEN_SCALE).

std::vector< int > & btk::C3DFileIO::GetAnalogZeroOffset ( )
inline

Returns the vector of offsets used for the analog channels' scaling (parameter ANALOG:OFFSET).

const std::vector< int > & btk::C3DFileIO::GetAnalogZeroOffset ( ) const
inline

Returns the vector of offsets used for the analog channels' scaling.

double btk::C3DFileIO::GetPointScale ( ) const
inline

Returns the scale for the points obtains from the POINT:SCALE parameter or from its determination for a created acquisition.

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

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

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

Read the file designated by filename and fill output.

Implements btk::AcquisitionFileIO.

void btk::C3DFileIO::SetAnalogChannelScale ( const std::vector< double > &  s)
inline

Sets the vector of scales used for the analog channels' scaling.

void btk::C3DFileIO::SetAnalogIntegerFormat ( AnalogIntegerFormat  f)
inline

Sets the integer format used to store analog channels data.

void btk::C3DFileIO::SetAnalogUniversalScale ( double  s)
inline

Sets Returns the universal scale factor used to scale analog channels.

void btk::C3DFileIO::SetAnalogZeroOffset ( const std::vector< int > &  s)
inline

Sets the vector of offsets used for the analog channels' scaling.

void btk::C3DFileIO::SetPointScale ( double  s)
inline

Sets the scale for the points.

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

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

Before writing the acquisition in a C3D file, this method do some operation. In the order:

  • update C3D scaling factors from acquisition's data (see flag C3DFileIO::ScalesFromDataUpdate)
  • synchronize acquisition's data with meta-data required in a C3D file (see flag C3DFileIO::MetaDataFromDataUpdate). These flag can be disabled by using the method C3DFileIO::SetWriteFlag(). The required C3D scaling factor can also be updated by acquisition's metadata (see flag C3DFileIO::ScalesFromMetaDataUpdate) ;

Implements btk::AcquisitionFileIO.