Skip to main content

MarkersReference.m


% This function is part of the NMSM Pipeline, see file for full license.
%
%
%
% (string) -> (MarkersReference)
% Makes a MarkersReference from a given model and parameters


function markersReference = MarkersReference(fileName)
import org.opensim.modeling.TimeSeriesTableVec3
import org.opensim.modeling.SetMarkerWeights
import org.opensim.modeling.MarkerWeight
import org.opensim.modeling.MarkersReference
timeSeriesTable = TimeSeriesTableVec3(fileName);
strings = {};
columnNames = timeSeriesTable.getColumnLabels();
for i=0:columnNames.size()-1
strings{end+1} = columnNames.get(i);
end
markerNames = string(strings);
markerWeightSet = SetMarkerWeights();
for i=1:length(markerNames)
markerWeightSet.cloneAndAppend(MarkerWeight(markerNames(i), 1.0));
end
try
markersReference = MarkersReference(fileName, markerWeightSet);
catch
markersReference = MarkersReference(fileName);
markersReference.setMarkerWeightSet(markerWeightSet)
end
timeSeriesTable = libpointer;
end