Page 1 of 1

.trc file editing

Posted: Tue Oct 23, 2018 1:37 pm
by monkey
The attached file labeled markers.xml is the file I am using for the Opensim model leg6dof9musc.

In Vicon, I detached the markers I didnt need (the right leg markers) for this new model. However, the .trc file is showing 18 markers. It should show on 12. The extra markers in the .trc file are as follows:

LHJC
RHJC
LKJC
RKJC
LAJC
RAJC

In order for Opensim to take this .trc it must only contain 12 to match the markers.xml file.

How do you suggest I delete the extra markers in the .trc file?
These markers do not show up in VICON so I really dont know why they are appearing in the .trc file.
Thank you kindly,

Re: .trc file editing

Posted: Tue Oct 23, 2018 2:13 pm
by jimmy
In order for Opensim to take this .trc it must only contain 12 to match the markers.xml file.
That is not correct. There can be any number of markers in a trc file. What matters is the markerset you have on the model reflects (at least) a sub-set of markers in the trc file. If you collected markers for both legs, but your model is only a single leg, you can still use a trc file with all the markers- just track the markers that you care about.

Re: .trc file editing

Posted: Thu Oct 25, 2018 7:12 pm
by cmwille
Hi Christine,

Thanks for starting this thread. I am also trying to delete virtual markers from a .trc file. I was able to do it using the code below but now I am having issues writing to a .trc file again (error attached as image). Per this link (https://github.com/opensim-org/opensim-core/issues/2262) I don't think my metadata is being saved in the matlab struct but I'm unsure how to call that specifically. Were you able to resolve your issue a different way Christine?

Thanks,
Christa

% Read files into memory as an opensim table
trcOpenSimTable = TRCFileAdapter().read(path2file);

% Convert to a Matlab Struct that is easier to work with
trcStruct = osimTableToStruct(trcOpenSimTable);

% Delete additional virtual markers using rmfield https://www.mathworks.com/matlabcentral ... -structure
trcStruct = rmfield(trcStruct,'vRHJC');

%% Convert Structs back into OpenSim table
newTable = osimTableFromStruct(trcStruct);

% Write back to file
TRCFileAdapter().write(newTable,filepath)