% This function is part of the NMSM Pipeline, see file for full license.
%
% Returns the values of the task. A task comes from
% parseJointModelPersonalizationSettingsTree.m in inputs.task{index}.
%
% (Model, task) -> (1D Array of string, 1D Cell Array)
% Runs the Joint Model Personalization algorithm
function [taskDescriptions, values] = ...
reportJointModelPersonalizationValues(model, task)
model = Model(model);
values = {};
taskDescriptions = string([]);
for i=1:length(task.parameters)
p = task.parameters{i};
values{end + 1} = getFrameParameterValue( ...
model, p{1}, p{2}, p{3}, p{4});
taskDescriptions(end + 1) = makeJointParameterTaskDescription( ...
p{1}, p{2}, p{3}, p{4});
end
for i=1:length(task.scaling)
values{end + 1} = getScalingParameterValue(model, task.scaling(i));
taskDescriptions(end + 1) = makeScalingParameterTaskDescription( ...
task.scaling(i));
end
for i=1:length(task.markers)
[x, y, z] = getMarkerParameterValues(model, task.markers(i));
values{end + 1} = [x, y, z];
taskDescriptions(end + 1) = makeMarkerParameterTaskDescription( ...
task.markers(i));
end
end
function out = makeJointParameterTaskDescription(jointName, isParent, ...
isTranslation, coordNum)
out = jointName;
if isParent
out = strcat(out, " parent");
else
out = strcat(out, " child");
end
if isTranslation
out = strcat(out, " translation");
else
out = strcat(out, " orientation");
end
if coordNum == 0
out = strcat(out, " x");
return
end
if coordNum == 1
out = strcat(out, " y");
return
end
if coordNum == 2
out = strcat(out, " z");
return
end
end
function out = makeScalingParameterTaskDescription(bodyName)
out = strcat("Scaling ", bodyName);
end
function out = makeMarkerParameterTaskDescription(markerName)
out = strcat("Marker ", markerName);
end