Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Jasper Verheul
- Posts: 7
- Joined: Thu Jan 26, 2017 5:46 am
Post
by Jasper Verheul » Fri May 06, 2022 9:10 am
Hi all,
I run into an issue scaling a model. After setting up the ScaleTool in the GUI and saving it as an .xml, I want to run this same scaling setup via the MATLAB API, using a different static trial for each participant. However, the scaling results are different from the GUI (and inappropriate). Does anyone know why the same scaling setup can give a different result when ran in the GUI vs MATLAB?
The MATLAB code I use is.
Code: Select all
% Load the generic scaling setup file
scaleTool = ScaleTool('setupScaling.xml');
% Set up model and (static) marker files
scaleTool.getGenericModelMaker().setModelFileName([folders.models genericModel]);
scaleTool.getModelScaler().setMarkerFileName([folders.data participant '_Static_markers.trc']);
scaleTool.getModelScaler().setOutputModelFileName([folders.models participant '_scaled.osim']);
scaleTool.getMarkerPlacer().setStaticPoseFileName([folders.data participant '_Static_markers.trc']);
scaleTool.getMarkerPlacer().setOutputModelFileName([folders.models participant '_scaled.osim']);
% Set participant mass
scaleTool.setSubjectMass(participantMass);
% Run scaling
scaleTool.run();
Many thanks for any help.
Jasper
Tags:
-
Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Post
by Ayman Habib » Mon May 23, 2022 11:38 am
Hi Jasper,
There're many options/knobs in the scale tool that may have values that are different between the GUI and the Matlab sides because you didn't explicitly initialize them. I'd print the Matlab setup to an XML file (using
Code: Select all
scaleTool.print("scaleToolFromMatlab.xml")
and compare the two XML files. In general the GUI and Matlab pathways exercise the same code underneath so it's just a matter of initializing all the options to similar values.
Hope this helps,
-Ayman
-
Jasper Verheul
- Posts: 7
- Joined: Thu Jan 26, 2017 5:46 am
Post
by Jasper Verheul » Tue May 31, 2022 4:44 am
Hi Ayman,
Thanks for your reply and suggestions.
When I print the "scaleToolFromMatlab.xml" file and open -> run it via the GUI, the scaling results from the MATLAB API are still different from those in the GUI (see figure attached).
When comparing the setup XML files printed in MATLAB and saved via the GUI, both files are the identical.
Thanks
Jasper
-
Attachments
-
- GUIvsAPI2.png (297.79 KiB) Viewed 526 times
-
Jasper Verheul
- Posts: 7
- Joined: Thu Jan 26, 2017 5:46 am
Post
by Jasper Verheul » Wed Jun 15, 2022 4:55 am
The issue seems to be introduced by the saving process. When the model is scaled in the GUI -> saved as a new scaled model -> reopened in the GUI, the same thing happens. In other words, the right model in the image above changes into the left model by saving -> reopening.