Editing C3D file

Hi everyone,

I am using the MoCap_LowerBody model and trying to figure out how to adapt this model to a patient specific gait.
As a new user, I would like first to better understand a C3D file before to process to experimental measuring.
In other words, I would like to open it as a text file and see its internal structure. And why not to slightly change values of sensor if possible.

I must admit that I am encountering difficulties … thank you in advance for your advices.

Hi So_ANY

C3D is the defacto standard for MOCAP data within the field of biomechanics. There is a whole homepage dedicated to the format and how the files are structured.

www.c3d.org

The C3D files are binary, so you can’t just open them using a text editor. And the structure is not completely obvious. It is a rather old file-format.

You can use AnyBody to explore the C3D file, using the AnyInputC3D class. But if you also want to change the file I highly recommend the open source program; Mokka.

http://b-tk.googlecode.com/svn/web/mokka/index.html

It allows you to view the c3d files and change all the meta data.

/Morten

Hi melund, and many thanks for your quick reply.

I had a closer look to Mokka and most of its features.
It appears to me a very intuitive and complete program to visualize C3D files.

But unfortunately, I only found a menu with metadata information and no possibilities to edit, for example, X, Y and Z coordinates of a marker.
Am I missing something ?

You can delete and rename markers, crop/delete frames, add/remove/rename events. You can apply filters to the analog data, scale and rectify it. You can run algorithms to detect the foot strikes etc. You can also change all the metadata (click view->MetaData).

I don’t think there is a way to directly edit the recorded data in an Excel-like fashion. But I don’t see how that could ever be useful from a GUI application.

If you need to work with the data for manipulation/plotting, then you can use the BTK library. That is also what Mokka does behind the scenes. The library allows you to load data into Matlab or python where you could change single values if you really need to do that.

Thanks again Melund, but I have the feeling that it is not possible to change (e.g. edit) metadata with Mokka, but only to view it (Toolbar -> View -> Metadata).

The reason why I would like to access C3D data is to modify several values.
My idea is to slightly change coordinates of several markers in order to shift a bit the leg externally and see if the values of muscles forces during the gait are changing significantly or not.

I will have a look straight away to the Library you mentioned, maybe that could be helpful.

Another way to accomplish this would be to move the markers attached to the body.

Please note that moving the leg will alter the way the forces are applied to the foot, so if you move leg laterally it may increase the ankle inversion/eversion moment.

Best regards
Søren

Hi

Søren is absolutely right. You should change where the markers are placed on the model, not the actual measured data.

/Morten

Actually my knowledge with Matlab is limited and I have no access to this software for the moment.

You are perfectly right, I could act on markers directly from Anybody.
But ideally I am looking for editing the actual measured data of the C3D file as it would allow for further possibilities.

My question is therefore: does Mokka provide this kind of feature ?
I didn’t find anything dealing with edition, not event modifying Matadata (only viewing possibilities through the upper panel “View”).

Thanks in advance,

Hi

I am sorry but we are not experts in Mokka so if this is possible or not we do not know…

I did a quick google and found this overview page which does say “edit” if this covers what you are looking for i am not sure.

https://b-tk.googlecode.com/svn/doc/Mokka/0.5/_mokka_menu_bar.html#MokkaMenuBarEdit

Best regards
Søren

Hi,

I also found this page a few days ago, but there is no menu available to modify for metadata: “Show/Hide metadata information (read only)”.

Anyway, I read information on the Wiki of AnyScript about MoCap model but few explanations are still unclear to me.
I therefore tried several manipulations on Anybody, let me explain.

As you suggested, I modified Z values of markers on the right leg by adding 2cm: red dots are a bit shifted externally.
Therefore, I increased thigh’s length as I moved RKNE and RTHI but not RASI, don’t you think ?
So, how is it possible that blue dots (from experimental data) can be matched with red ones as I changed lengths of the right lower limbs ?

As you can see, I am a bit confused on how Anybody manages the analysis …

Hi

Yes you are right in principle if you move the two knee makers and keep pelvis markers unchanged the length will also change a bit this is correct.

It would be possible to switch off the optimization of the segments lenghts so that the model would keep the thigh length unchanged and try to match the markers, this can be done int he MOdelSetyp.any file i think.

This requires that you have a good guess on a correct length of the bone available, maybe from a previous analysis

Hope it made sense, otherwise please ask again.

Best regards
Søren

Hi So_Any

Just an update on Mokka. You are right about Mokka not being able to edit the raw data. I newer tried to do somehting like that with Mokka.

However, you can do it if you use the B-TK library directly. B-TK is also the library that Mokka uses behind-the-scene to access C3D files.

I suggested using it from Matlab since that is what most academic users are familiar with. Like you, I don’t have access to Matlab, but there is a free alternative. Professor Marcos Duarte has a nice tutorial on how to use B-TK to manipulate c3d files using python (which is a free programming language).

http://nbviewer.ipython.org/github/demotu/BMC/blob/master/notebooks/OpenC3Dfile.ipynb

A quick hint for AnyBody and how AnyBody does its analysis. I found this paper really useful. It describes the method which is implemented in AnyBody.

It is fairly mathematical but is has a nice example at the end which describes the concept.

/Morten

Hi,

Many thanks for your precious answers toerholm and melund, they were indeed more than helpful to me.

I am pretty pleased after all as I managed to change coordinates values in a C3D file thanks to B-TK on MATLAB.
Here a link that may be useful for other people: https://b-tk.googlecode.com/svn/doc/Matlab/0.3/_tutorial.html

So, I added 2cm to Z values of markers from the right leg, generated a new C3D file and ran an InverseDynamics Analysis on Anbody (but first a MotionAndParameterOptimization).
When I compare coordinates between the original C3D right markers and the modified C3D ones, I find this 2cm shift along Z axis.
Additionally, there is no variation for left markers, which gives me comfort.

If I’m not wrong, the MotionAndParameterOptimization adapts the lengths of the lower limbs to the C3D file.
But what is happening to the force coming from the plate? As my right foot is shifted a bit externally, is its application point also shifted or not?
I have difficulties to understand how does Anybody consider this force coming from the ground.

No, the point of application is not moved by moving changing the kinematics of the model.

That is because the point of application of the force (center of pressure) is solely defined by the forces measured by the force plate.

However, you don’t have to change the actual measured forces to shift the forces. It is easily done by changing the force plate meta-data in the c3d file.

You need to modify the origin parameter in the c3d file. See this link:
https://www.c3d.org/HTML/default.htm?turl=origin.htm

/Morten

Alright, that’s what I though.

Actually this is a good idea to change metadata instead of the forces, it should be an easier manipulation.
I will take a look at this according to your link.

In any case, thanks for everyone replying to this thread and for your precious support.

Hiii,
Can anyone please tell me how to edit marker names in c3d file

Hi Raghav

That is something you can do with Mokka or the b-tk library (if you want to do it programmatically for many files)

For Mokka: Just open the c3d file select a marker on the right side of the screen. The change the label name in the properties field (lower right corner of the screen).

/Morten

Thanks melund that was helpful, can you please help me with some questions below about using a MoCap model with my own c3d file:
1.I have attached a c3d file,can u please tell me what all changes i have to make in MoCap model (lower extremity model) to use this c3d file ?