Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

The OpenSim 4.0 API includes methods for reading C3D data into OpenSim formatted files. The OpenSim C3DFileAdapter() class uses a forked version of Arnaud Barre's BTK package. Use of the C3DFileAdapter is limited to C++ and scripting with example code below. 

Reading C3D files through Matlab

Documentation for the C3DFIleAdapter is located here. There is a working example Matlab script in your resources directory /Code/Matlab/c3dExport.m

C3DFileAdapter()

To use the OpenSim classes directly, follow the code below. This code will give you OpenSim Times Series Tables for both markers and forces. 

 Click here to expand...
%% Read C3D into memory
% Import OpenSim Library
import org.opensim.modeling.*
 
% Instantiate a C3DFileAdapter()
c3dAdapter = C3DFileAdapter();
% Read c3d data
data = c3dAdapter.read('walking2.c3d');
% Get a TimesSeriesTable with all the marker Data
markers = data.get('markers');
% Get a TimeSeriesTable with all the Force Data
forces = data.get('forces');

osimC3D

We have included a Matlab side class that can be used to perform some common operations, such as rotating data, converting data into Matlab data types, and writing marker and force data to OpenSim file format. The Matlab file can be found in your resources directory /Code/Matlab/Utilities/osimC3D.m

 Click here to expand...


Reading C3D files through Python and C++

Some example code for using C3DFileAdapter through Python can be found below. 

 Click here to expand...

 

 

Example code for using the C3DFileAdapter in C++ is found below

 Click here to expand...

 

 

 

 

 

 

 

 

  • No labels