.trc file editing

The 2018 Fall Virtual Workshop will bring together a group of international scholars and OpenSim experts to help each other advance their research using modeling and simulation. This forum is a place to accelerate OpenSim based projects while also buildin
POST REPLY
User avatar
Christine Dailey
Posts: 17
Joined: Fri Feb 09, 2018 6:55 am

.trc file editing

Post by Christine Dailey » Tue Oct 23, 2018 1:37 pm

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,
Attachments
markers.xml
(8.42 KiB) Downloaded 11 times

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: .trc file editing

Post by jimmy d » Tue Oct 23, 2018 2:13 pm

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.

User avatar
Christa Wille
Posts: 1
Joined: Tue May 30, 2017 11:11 am

Re: .trc file editing

Post by Christa Wille » Thu Oct 25, 2018 7:12 pm

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)
Attachments
Screen Shot 2018-10-25 at 9.09.04 PM.png
Screen Shot 2018-10-25 at 9.09.04 PM.png (120.49 KiB) Viewed 247 times

POST REPLY