I have a template XML scale setup file and a MATLAB script that changes model filenames, output file names, start/stop time, and .TRC files. I am manually scaling the femur and tibia and want to have the script changes these values in the .XML file as well. I used the below code to properly create the scaleset for the 4 manual scales; however, it outputs this scale set into a separate XML file. How can I 1. replace the existing scale set in my template XML file with this one OR 2. Just change the scales in my template XML file?
CODE FOR CREATING SEPARATE SCALE SET:
Code: Select all
%ADD MANUAL SCALING FOR FEMUR AND TIBIA
ModelSCL=scaleTool.getModelScaler()
b=scaleTool.getModelScaler()
AS=ArrayStr();
AS.setSize(2);
AS.setitem(0,'measurements');
AS.setitem(1,'manualScale');
b.setScalingOrder(AS);
%SET UP MANUAL
scaleToolManual=ScaleSet();
scaleToolManual.setSize(700);
for i =1:4
if i==1;
name='femur_r'
SFvec=Vec3(1.5,1.5,1.5)
elseif i==2
name='femur_l'
SFvec=Vec3(2.5,1.5,1.5)
elseif i==3
name= 'tibia_r'
SFvec=Vec3(3.5,1.5,1.5)
elseif i==4
name='tibia_l'
SFvec=Vec3(4.5,1.5,1.5)
end
S(i)=Scale;
S(i).setSegmentName(name)
S(i).setScaleFactors(SFvec)
scaleToolManual.cloneAndAppend(S(i))
end
scaleToolManual.print('scale_set.xml')