pyomeca / ezc3d

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

Writing C3D files with only Analog data: required paramaters #293

Closed jagusto33 closed 1 year ago

jagusto33 commented 1 year ago

Hello,

I was having some issues with my C3D files being read by the Visual 3D software program for specific trials where I only have analog data to write to my C3D.

For example, I have 8 channels of analog data that I have been able to successfully write to a C3D file. However, the data does not load correctly when I try to open the newly created C3D file. I believe my issue may be in part because I am required to write the POINT:DATA_START, POINT:FRAMES, and POINT:USED parameters. For POINT:FRAMES, I was planning to write the total number of frames in my ANALOG data. However, for POINT:DATA_START, I do not understand how to define the value for this. I have looked at numerous examples from existing C3D files I have that have both POINT and ANALOG data, but there does not seem to be a reliable way to set the POINT:DATA_START value.

Any suggestions would be greatly appreciated!

pariterre commented 1 year ago

Hi @jagusto33

Thanks for using ezc3d!

POINT:DATA_START will be impossible for you to find. It is not related to the data (despite the name). It is related to internal structure of the c3d binary file. To be more precise, it is the exact byte offset where the data start compared to the beginning of the file. This is used so the software reading the c3d knows exactly where to jump in the binary file to start reading the data. It mostly depends on the number of parameters stored in the c3d and sometimes their order, as the data are stored after the parameters in the file. As it is an internal structure, ezc3d will automatically compute this value and override any values you try to provide when using the write method.

The short answer is therefore: don't worry about this parameter

Cheers

jagusto33 commented 1 year ago

Excellent, thank you! I realized that the key parameter I was missing was the POINT: FRAMES data for my trials where I only have ANALOG data. I added the number of frames of my ANALOG data to that parameter and it worked.