Page 1 of 1

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

Posted: Tue Oct 23, 2018 12:03 pm
by mariacfox
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

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

Posted: Tue Oct 23, 2018 12:28 pm
by pariterre
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 :)

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

Posted: Tue Oct 23, 2018 12:47 pm
by mariacfox
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

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

Posted: Tue Oct 23, 2018 2:48 pm
by chrisdembia
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.

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

Posted: Tue Oct 23, 2018 3:27 pm
by mariacfox
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