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 4 Next »

The OpenSim 4.0 API includes methods for reading C3D data into OpenSim formatted files. Marker (.trc) and Forceplate (.mot) data can be created using OpenSim C3DFileAdapter class, which uses a forked version of Arnaud Barre's BTK package. Use of the C3DFileAdapter and included Matlab utilities are described below. 

Reading C3D files through Matlab

Documentation for the C3DFIleAdapter is located here

 

%% 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');
%% Read C3D into memory
% Import OpenSim Library
import org.opensim.modeling.*

% Use the osimC3D utlity class
c3d = osimC3D('Walking_trial.c3d',1);

% Rotate the Marker and force data by 90 degrees
c3d.rotateData('x',-90);

% Get the Marker and Force data as Matlab Structures
[markers forces] = c3d.getAsStructs();

% Get the Marker and Force data as OpenSim TimeSeriesTables()
markerTable = c3d.getTable_markers();
forcesTable = c3d.getTable_forces();

% Get Number of Markers and Forces
nMarkers = c3d.getNumTrajectories();
nForces = c3d.getNumForces();

% Get Data rate for Markers and Forces
markerRate = c3d.getRate_marker();
forceRate = c3d.getRate_force();

% Get the Start and End time of the data
startTime = c3d.getStartTime();
endTime = c3d.getEndTime();

% Write the Marker and Force data. Writing function can take (i) no input
% (writes file to path of the input c3d), (ii) output file name (writes to 
% the same folder as the c3d, but with the specified filename), or (iii) a 
% full path to file (writes file to the full path specified). 
c3d.writeTRC('Output.trc') 
c3d.writeMOT('/Users/person/experiment/data/Output.mot') 
 
 
 
 

Reading Data through Python and C++

 
 

Marker Data 

 

 

Force Data

 

 

 

 

 

 

 

 

  • No labels