How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

The 2018 Fall Virtual Workshop will bring together a group of international scholars and OpenSim experts to help each other advance their research using modeling and simulation. This forum is a place to accelerate OpenSim based projects while also buildin
POST REPLY
User avatar
Maria Fox
Posts: 14
Joined: Tue Oct 29, 2013 8:11 am

How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

Post by Maria Fox » Tue Oct 23, 2018 12:03 pm

Hi all,

I'm trying to update my c3d conversion methods for OpenSim 4.0 using the provided osimC3D methods. I can import the osimC3D object and assign the markers and forces to structures for editing, but I need help with:
1) How to save edited marker/force structures back to the osimC3D object?
2) How to access analog channels/data in osimC3D?

I've tried the following method to assign the marker structure back to the object, but I get an error. Does anyone know how to go about this?

Code: Select all

c3d = osimC3D([directory{i} c3dfileNames.(subID{i}){j}], 1);
                
[markerStruct, forceStruct] = c3d.getAsStructs();

% compute virtual markers
markerStruct = computeVirtualMarkers(markerStruct,1); % my custom function 

% save edited markers back to osimC3D object?
>> c3d.markers = osimTableFromStruct(markerStruct);
You cannot set the 'markers' property of osimC3D. 
Thanks!
Maria

User avatar
Benjamin Michaud
Posts: 31
Joined: Mon May 03, 2010 6:35 am

Re: How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

Post by Benjamin Michaud » Tue Oct 23, 2018 12:28 pm

Hello Maria,

I know this is a bit off topic, but if your goal is to only load/write c3d, I suggest that you have a look at ezc3d on github. It could do what you need just fine :)

If you do so, please let me know if anything doesn't work, I am currently doing a rush on improving the library!

Thanks :)

User avatar
Maria Fox
Posts: 14
Joined: Tue Oct 29, 2013 8:11 am

Re: How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

Post by Maria Fox » Tue Oct 23, 2018 12:47 pm

Benjamin,

Thanks for the suggestion, but unfortunately that will not work for me. I need to do some processing to all the marker, force, and analog data. I was using the c3d2OpenSim toolbox with some custom functions to make these adjustments, but I want to update everything for OpenSim 4.0 now. It might just be easiest for me to work with my existing code and update the trc/mot file headers.

Thanks,
Maria

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

Post by Christopher Dembia » Tue Oct 23, 2018 2:48 pm

You cannot update or modify the original C3D file. The workflow is to load the C3D file, perform the transformations you want, then write out TRC and MOT files.

User avatar
Maria Fox
Posts: 14
Joined: Tue Oct 29, 2013 8:11 am

Re: How to edit marker/force/analog data during c3d conversion in MATLAB (Opensim4.0 & osimC3D)

Post by Maria Fox » Tue Oct 23, 2018 3:27 pm

Christopher,

I'm not trying to modify the c3d files themselves (which you can actually do in Mokka, but it's not scaleable for many trials); I'm trying to modify the files once imported as structures in MATLAB. That is what I currently do with my code, but I didn't know if it was possible to have a similar protocol with the new osimC3D methods in MATLAB. I went ahead and updated the headers in c3d2OpenSim's code since those required very little change and my files seem to be working fine in OpenSim 4.0.

Thanks,
Maria

POST REPLY