API  4.5
For C++ developers
OpenSim::C3DFileAdapter Class Reference

C3DFileAdapter reads a C3D file into markers and forces tables of type TimeSeriesTableVec3. More...

+ Inheritance diagram for OpenSim::C3DFileAdapter:

Public Member Functions

C3DFileAdapterclone () const override
 
void setLocationForForceExpression (const ForceLocation location)
 C3DFileAdpater provides options for expressing the force-plate measurements either as the net force and moments expressed at the ForcePlateOrigin, the CenterOfPressure, or the PointOfWrenchApplication. More...
 
ForceLocation getLocationForForceExpression () const
 Retrieve the option for location for force expression. More...
 
std::shared_ptr< TimeSeriesTableVec3getMarkersTable (DataAdapter::OutputTables &tables)
 Retrieve the TimeSeriesTableVec3 of Markers. More...
 
std::shared_ptr< TimeSeriesTableVec3getForcesTable (DataAdapter::OutputTables &tables)
 Retrieve the TimeSeriesTableVec3 of Forces. More...
 
std::shared_ptr< TimeSeriesTablegetAnalogDataTable (DataAdapter::OutputTables &tables)
 Retrieve the TimeSeriesTable of AnalogData, typically this contains forces, moments. More...
 
- 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
 
DataAdapter::OutputTables read (const std::string &dataSourceSpecification) const
 Public interface to read data from a dataSourceSpecification, typically a file or folder. More...
 
const std::shared_ptr< AbstractDataTablegetDataTable (const OutputTables &tables, const std::string tableName)
 Generic interface to retrieve a specific table by name from read result. More...
 

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 void write (const Tables &markerTable, const std::string &fileName)
 
- Static Public Member Functions inherited from OpenSim::FileAdapter
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 std::vector< std::string > tokenize (const std::string &str, const std::string &delims)
 Tokenize/split a given string using the given delimiters. More...
 
static std::shared_ptr< DataAdaptercreateAdapterFromExtension (const std::string &fileName)
 Create a concerte FileAdapter based on the extension of the passed in file and return it. 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
 
static const std::string _analog
 

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

Detailed Description

C3DFileAdapter reads a C3D file into 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 CenterOfPressure, or the PointOfWrenchApplication.

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. You need to call setLocationForForceExpression before invoking C3DFileAdapter::read(), otherwise the default location (OriginOfForcePlate) is assumed.

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

C3DFileAdapter c3dFileAdapter;
c3dFileAdapter.setLocationForForceExpression(C3DFileAdapter::ForceLocation::CenterOfPressure);
auto tables = c3dFileAdapter.read("myData.c3d");
auto markersTable = c3dFileAdapter.getMarkersTable(tables);
auto forcesTable = c3dFileAdapter.getForcesTable(tables);
auto analogDataTable = c3dFileAdapter.getAnalogDataTable(tables);

Python example

import opensim
c3dFileAdapter = opensim.C3DFileAdapter()
c3dFileAdapter.setLocationForForceExpression(opensim.C3DFileAdapter.ForceLocation_CenterOfPressure);
tables = c3dFileAdapter.read("myData.c3d")
markersTable = c3dFileAdapter.getMarkersTable(tables)
forcesTable = c3dFileAdapter.getForcesTable(tables)

Java example

C3DFileAdapter c3dFileAdapter = new C3DFileAdapter();
c3dFileAdapter.setLocationForForceExpression(C3DFileAdapter.ForceLocation.CenterOfPressure);
tables = c3dFileAdapter.read("myData.c3d");
TimeSeriesTableVec3 markersTable = c3dFileAdapter.getMarkersTable(tables);
TimeSeriesTableVec3 forcesTable = c3dFileAdapter.getForcesTable(tables);

MATLAB example

c3dFileAdapter = C3DFileAdapter();
c3dFileAdapter.setLocationForForceExpression(1);
tables = c3dFileAdapter.read('myData.c3d');
markersTable = c3dFileAdapter.getMarkersTable(tables);
forcesTable = c3dFileAdapter.getForcesTable(tables);
Enumerator
OriginOfForcePlate 

0 : the origin of the force-plate

CenterOfPressure 

1 : the center of pressure

PointOfWrenchApplication 

2 : PWA as defined by Shimba, 1984

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.

◆ getAnalogDataTable()

std::shared_ptr<TimeSeriesTable> OpenSim::C3DFileAdapter::getAnalogDataTable ( DataAdapter::OutputTables tables)
inline

Retrieve the TimeSeriesTable of AnalogData, typically this contains forces, moments.

◆ getForcesTable()

std::shared_ptr<TimeSeriesTableVec3> OpenSim::C3DFileAdapter::getForcesTable ( DataAdapter::OutputTables tables)
inline

Retrieve the TimeSeriesTableVec3 of Forces.

◆ getLocationForForceExpression()

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

Retrieve the option for location for force expression.

◆ getMarkersTable()

std::shared_ptr<TimeSeriesTableVec3> OpenSim::C3DFileAdapter::getMarkersTable ( DataAdapter::OutputTables tables)
inline

Retrieve the TimeSeriesTableVec3 of Markers.

◆ setLocationForForceExpression()

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

C3DFileAdpater provides options for expressing the force-plate measurements either as the net force and moments expressed at the ForcePlateOrigin, the CenterOfPressure, or the PointOfWrenchApplication.

This function sets the option.

◆ write()

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

Member Data Documentation

◆ _analog

const std::string OpenSim::C3DFileAdapter::_analog
static

◆ _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: