API  4.0
For C++ developers
OpenSim::C3DFileAdapter Class Reference
+ Inheritance diagram for OpenSim::C3DFileAdapter:

Public Member Functions

 C3DFileAdapter ()=default
 
 C3DFileAdapter (const C3DFileAdapter &)=default
 
 C3DFileAdapter (C3DFileAdapter &&)=default
 
C3DFileAdapteroperator= (const C3DFileAdapter &)=default
 
C3DFileAdapteroperator= (C3DFileAdapter &&)=default
 
 ~C3DFileAdapter ()=default
 
C3DFileAdapterclone () const override
 
void setLocationForForceExpression (const ForceLocation location)
 
const ForceLocation getLocationForForceExpression () const
 
- Public Member Functions inherited from OpenSim::FileAdapter
 FileAdapter ()=default
 
 FileAdapter (const FileAdapter &)=default
 
 FileAdapter (FileAdapter &&)=default
 
FileAdapteroperator= (const FileAdapter &)=default
 
FileAdapteroperator= (FileAdapter &&)=default
 
virtual ~FileAdapter ()=default
 
- Public Member Functions inherited from OpenSim::DataAdapter
 DataAdapter ()=default
 
 DataAdapter (const DataAdapter &)=default
 
 DataAdapter (DataAdapter &&)=default
 
DataAdapteroperator= (const DataAdapter &)=default
 
DataAdapteroperator= (DataAdapter &&)=default
 
virtual ~DataAdapter ()=default
 

Public Types

enum  ForceLocation { ForceLocation::OriginOfForcePlate = 0, ForceLocation::CenterOfPressure = 1, ForceLocation::PointOfWrenchApplication = 2 }
 Enumerated list of locations in which read in forces are expressed. More...
 
typedef std::vector< EventEventTable
 
typedef std::map< std::string, std::shared_ptr< TimeSeriesTableVec3 > > Tables
 
- Public Types inherited from OpenSim::DataAdapter
typedef std::map< std::string, std::shared_ptr< DataAdapter > > RegisteredDataAdapters
 Type of the registry containing registered adapters. More...
 
typedef std::map< std::string, std::shared_ptr< AbstractDataTable > > OutputTables
 Collection of tables returned by reading methods implemented in derived classes. More...
 
typedef std::map< std::string, const AbstractDataTable * > InputTables
 Collection of tables accepted by writing methods implemented in derived classes. More...
 

Static Public Member Functions

static Tables read (const std::string &fileName, ForceLocation wrt=ForceLocation::OriginOfForcePlate)
 Read in a C3D file into separate markers and forces tables of type TimeSeriesTableVec3. More...
 
static void write (const Tables &markerTable, const std::string &fileName)
 
- Static Public Member Functions inherited from OpenSim::FileAdapter
static OutputTables readFile (const std::string &fileName)
 Read a file with the given name. More...
 
static void writeFile (const InputTables &tables, const std::string &fileName)
 Write a collection of tables to the given file. More...
 
static std::string findExtension (const std::string &filename)
 Find the extension from a filename. More...
 
static std::vector< std::string > getNextLine (std::istream &stream, const std::string &delims)
 Get the next line from the stream and tokenize/split the line using the given delimiters. More...
 
- Static Public Member Functions inherited from OpenSim::DataAdapter
static bool registerDataAdapter (const std::string &identifier, const DataAdapter &adapter)
 Register a concrete DataAdapter by its unique string identifier. More...
 

Static Public Attributes

static const std::string _markers
 
static const std::string _forces
 

Protected Member Functions

OutputTables extendRead (const std::string &fileName) const override
 Implements reading functionality. More...
 
void extendWrite (const InputTables &tables, const std::string &fileName) const override
 Implements writing functionality. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from OpenSim::FileAdapter
static std::vector< std::string > tokenize (const std::string &str, const std::string &delims)
 Tokenize/split a given string using the given delimiters. More...
 
- Static Protected Member Functions inherited from OpenSim::DataAdapter
static std::shared_ptr< DataAdaptercreateAdapter (const std::string &identifier)
 Creator of concrete DataAdapter(s) for the specified source type by its unique identifier (string). More...
 

Member Typedef Documentation

◆ EventTable

◆ Tables

typedef std::map<std::string, std::shared_ptr<TimeSeriesTableVec3> > OpenSim::C3DFileAdapter::Tables

Member Enumeration Documentation

◆ ForceLocation

Enumerated list of locations in which read in forces are expressed.

Measurement from force plates can be expressed by the C3DFileAdapter either at the OriginOfForcePlate (the default), CenterOfPressure, or the PointOfWrenchApplication. It is an optional argument to C3DFileAdapter::read().

In the case of the CenterOfPressure (COP), the underlying assumptions are that the ground plane (in which COP is defined) passes through the lab origin (0,0,0) with the Z-axis as its normal vector.

The PointOfWrenchApplication (PWA) does not assume a plane of contact. The PWA is an equivalent wrench in the lab frame and computed according to Shimba 1984. Takeshi Shimba, An estimation of center of gravity from force platform data, Journal of Biomechanics, 17(1), pp53-60, 1984.

C++ example

Python example

import opensim
tables = C3DFileAdapter.read("myData.c3d",
opensim.C3DFileAdapter.ForceLocation_CenterOfPressure)

Java example

tables = C3DFileAdapter.read("myData.c3d",
C3DFileAdapter.ForceLocation.CenterOfPressure);

MATLAB example

tables = C3DFileAdapter.read("myData.c3d", 1);
Enumerator
OriginOfForcePlate 

0 : the origin of the force-plate

CenterOfPressure 

1 : the center of pressure

PointOfWrenchApplication 

2 : PWA as defined by Shimba, 1984

Constructor & Destructor Documentation

◆ C3DFileAdapter() [1/3]

OpenSim::C3DFileAdapter::C3DFileAdapter ( )
default

◆ C3DFileAdapter() [2/3]

OpenSim::C3DFileAdapter::C3DFileAdapter ( const C3DFileAdapter )
default

◆ C3DFileAdapter() [3/3]

OpenSim::C3DFileAdapter::C3DFileAdapter ( C3DFileAdapter &&  )
default

◆ ~C3DFileAdapter()

OpenSim::C3DFileAdapter::~C3DFileAdapter ( )
default

Member Function Documentation

◆ clone()

C3DFileAdapter* OpenSim::C3DFileAdapter::clone ( ) const
overridevirtual

Implements OpenSim::DataAdapter.

◆ extendRead()

OutputTables OpenSim::C3DFileAdapter::extendRead ( const std::string &  sourceName) const
overrideprotectedvirtual

Implements reading functionality.

Implements OpenSim::DataAdapter.

◆ extendWrite()

void OpenSim::C3DFileAdapter::extendWrite ( const InputTables tables,
const std::string &  sinkName 
) const
overrideprotectedvirtual

Implements writing functionality.

Implements OpenSim::DataAdapter.

◆ getLocationForForceExpression()

const ForceLocation OpenSim::C3DFileAdapter::getLocationForForceExpression ( ) const
inline

◆ operator=() [1/2]

C3DFileAdapter& OpenSim::C3DFileAdapter::operator= ( const C3DFileAdapter )
default

◆ operator=() [2/2]

C3DFileAdapter& OpenSim::C3DFileAdapter::operator= ( C3DFileAdapter &&  )
default

◆ read()

static Tables OpenSim::C3DFileAdapter::read ( const std::string &  fileName,
ForceLocation  wrt = ForceLocation::OriginOfForcePlate 
)
static

Read in a C3D file into separate markers and forces tables of type TimeSeriesTableVec3.

The markers table has each column labeled by its corresponding marker name. For the forces table, the data are grouped by sensor (force-plate #) in force, point and moment order, with the respective f#, p# and m# column labels. C3DFileAdpater provides options for expressing the force-plate measurements either as the net force and moments expressed at the ForcePlateOrigin, the CentereOfPressure, or the PointOfWrenchApplication (see above).

◆ setLocationForForceExpression()

void OpenSim::C3DFileAdapter::setLocationForForceExpression ( const ForceLocation  location)
inline

◆ write()

static void OpenSim::C3DFileAdapter::write ( const Tables markerTable,
const std::string &  fileName 
)
static

Member Data Documentation

◆ _forces

const std::string OpenSim::C3DFileAdapter::_forces
static

◆ _markers

const std::string OpenSim::C3DFileAdapter::_markers
static

The documentation for this class was generated from the following file: