ScaleTool API does not assign correct model file path

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sven Paldauf
Posts: 9
Joined: Wed Jun 06, 2018 2:08 am

ScaleTool API does not assign correct model file path

Post by Sven Paldauf » Sun Sep 30, 2018 10:54 am

Hi Guys,

I could not find a solution in the forum, so I would be happy if someone can held me:

I am trying to specify the path of the model I want to use for the ScaleTool via MATLAB.

Code: Select all

scaleTool = ScaleTool('C:\...\OSMATLAB_Batch_Walk\Subject01\ScaleSetup'\svegor_Setup_Scale.xml');
scaleTool.getGenericModelMaker().setModelFileName('C:\...\OSMATLAB_Batch_Walk\modelfile.osim');
scaleTool.getGenericModelMaker().setMarkerSetFileName('C:\...\OSMATLAB_Batch_Walk\Subject01\ScaleSetup\svegor_MarkerSet.xml');
scaleTool.run();
Important: *Note that the Model file is two hierarchical levels above the Scaletool setup file!*

What I get is following:

Code: Select all

Step 1: Loading generic model

Exception:
  Object: Cannot not open file
  C:\...\OSMATLAB_Batch_Walk\Subject01\ScaleSetup\C:\...\MATLAB\OSMATLAB_Batch_Walk\modelfile.osim.
  It may not exist or you do not have permission to read it.
  Thrown at object.cpp:104 in Object().
  line= 2632
If I set the modelfile, the path is incorrect since it adds the path I assigned to the path where the setupfile is located.

If I would store the model file in the setup file folder, it works, but this is what I'm trying to avoid.

I also tries to type in the setup file "Unassigned", but this also does not work.

I hope you understand my problem and would be happy for any help or idea.

Yours, Sven

Tags:

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: ScaleTool API does not assign correct model file path

Post by Thomas Uchida » Sun Sep 30, 2018 12:31 pm

Note that the Model file is two hierarchical levels above the Scaletool setup file!
Have you tried '..\..\OSMATLAB_Batch_Walk\modelfile.osim'?

User avatar
Sven Paldauf
Posts: 9
Joined: Wed Jun 06, 2018 2:08 am

Re: ScaleTool API does not assign correct model file path

Post by Sven Paldauf » Fri Oct 05, 2018 8:49 am

Hey Thomas,

thanks for your fast and sorry for my delayed reply.

I tried to do what you recommended, but there is still no difference to recognize. I still get the same error message because both paths are merged.

Can't explain to myself why such an issue occurs because I do the same with the IKTool and it sets the right path even if the files are in another folder.

I would appreciate if there are other ways or ideas to manage this. Otherwise I will save the model file and scale setup file in the same folder but this is rather a suboptimal solution for my purposes.

Thank you in advance,

Sven

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: ScaleTool API does not assign correct model file path

Post by Thomas Uchida » Fri Oct 05, 2018 11:17 am

The first line of your code is scaleTool = ScaleTool('C:\...\OSMATLAB_Batch_Walk\Subject01\ScaleSetup'\svegor_Setup_Scale.xml'); which looks like it contains 2 issues:
1. I don't think 3 periods ("...") is meaningful: if you want to use a relative path, I don't think the path string should begin with "C:\".
2. There's an extra quotation mark between "ScaleSetup" and "\svegor" which may have unexpected consequences.
You might want to look through the example scripts as well.

User avatar
Sven Paldauf
Posts: 9
Joined: Wed Jun 06, 2018 2:08 am

Re: ScaleTool API does not assign correct model file path

Post by Sven Paldauf » Sun Oct 07, 2018 5:49 am

In my actual code, the three dots in the path do not exist(it was only for simplification purposes to shorten the path, sorry for that).
And also the extra quotation mark between "ScaleSetup" and "\svegor" was only a mistake here since I use another variable name instead of '\svegor_Setup_Scale.xml'.

This is what I do:

scaleTool = ScaleTool('C:\Users\Sven\Documents\OSMATLAB_Batch_Walk\Subject01\ScaleSetup\svegor_Setup_Scale.xml');

The path for my scaleTool is right, but I still have the problem that an error occurs because of the merge of the paths (e.g.: path\path\filename) when setting the ModelFilePathName.

But I solved my problem by storing the model file in the same folder than the Setup file.

Nevertheless, thank you very much. Maybe I can come up with my issue at the next OpenSim workshop in Belgium in 4 weeks.

POST REPLY