pyomeca / ezc3d

Easy to use C3D reader/writer for C++, Python and Matlab
https://pyomeca.github.io/Documentation/ezc3d/index.html
MIT License
145 stars 46 forks source link

Treadmetrix Treadmill: Type 6 is not supported yet #342

Open Barronzz opened 2 months ago

Barronzz commented 2 months ago

Hi,

I'm trying to open a c3d file collected on a treadmetrix treadmill in matlab. When I run the matlab code it kicks out the message "Unexpected Standard exception from MEX file. What () is: Type 6 is not supported yet, please open an Issue on github for support." I did manage to confirmed the code works and is set up correctly by importing a c3d file collected on a bertec treadmill.

Any insights would be greatly appreciated.

P05_cut.c3d.zip

pariterre commented 2 months ago

Hi @Barronzz

Thanks for reporting! I did not have any Type-6 force platform to test yet, so I could not implement it. Now that you are providing me with one, I'll implement this soon, hopefully this week!

pariterre commented 2 months ago

Dear @Barronzz I just decided to have a quick look today. There is a problem...

Type-6 is not standard type of force platform for C3D format. This meaning there is no description of the type 6 in the official documentation of the C3D (c3d.org). This does not mean I am unable to support it, but I have some limitation...

Contrary to what we may expect, the forces (F), moments (M) and center of pressure (CoP) are not stored in the c3d file. The only thing which is store are the analog data (those in c.data.analogs (using the MATLAB accessor)). These data can thereafter be interpreted to retrieve the F, M and CoP, meaning when you are using the force platform module of ezc3d, this is merely a computation made from the analog data. The drawback to this is I must know what is the purpose of each channel in order to convert the analog data to F, M and CoP, and these channel can drastically vary from one company to another.

This is not a problem for standard format, as it is prescribed by the standard. But in your case, I do not know what the data columns represent. Do you have a manual with the Treadmetrix which provide the proper way to convert their analog data to actual force platform?

Barronzz commented 2 months ago

Hey @pariterre

That all makes a lot of sense. I hunted around the lab and can't find a user manual. I'm told this is the original treadmetrix treadmill so its possible there was never a manual. Instead I've attached pictures from V3D of what each analog channel is and the calibration matrix. Unfortunately I'm not sure I can get my hands on an actual manual.

Thanks for your help!

untitled folder.zip

pariterre commented 2 months ago

Hello there!

Yep, all these information are indeed in the C3D itself (as they are required to transform the analog data to actual forces, moments and center of pressure). However, I am still usure how to interpret the analog data stored in the c3d file once they are calibrated. Because, as we can see from your screenshot, we are able to calibrate the anologs using the CalMatrix, but multiplying the CAL_MATRIX to the ANALOG still outpus a vector that still reads like this: [Fx1, Fy1, Fz1, Fx2, Fy2, Fz2, Fx3, Fy3, Fz3, Fx4, Fy4, Fz4]

I am suspecting that these are the forces at each corner, but I don't see indication on how to transport all these force at a common origin and how to compute the moment (or center of pressure) from them. Without that information, we are unable to interpret these data properly. We still can try, but we are in the dark... And I know from other types that there are sometime subtle information that must be taken into account (such as OFFSET, which surprisingly does not seem to be part of your C3D)

In brief, there isn't much I can do without the docs... or at least there isn't much guesses I am willing to make without it (because as the programmer, if I am giving you results which are erroneous, I feel responsible for that...)

Hope you find it!