Using the gait 2392 model for kinematic and kinetic analyses

New project for OpenCap, which is a new software package to estimate 3D human movement dynamics from smartphone videos. OpenCap strongly relies on OpenSim.
User avatar
Bernhard Faerber
Posts: 27
Joined: Thu Nov 10, 2022 1:57 am

Using the gait 2392 model for kinematic and kinetic analyses

Post by Bernhard Faerber » Thu Sep 28, 2023 10:28 am

Hello everybody,

I'm currently trying to run kinematic and kinetic analyses on data recorded with OpenCap while using the gait2392 model that is included in OpenSim.
The main reason I want to use this model is to allow kinematic analyses of frontal plane knee ROM (Varus - Valgus).

I have tinkered around with the OpenCap-core as suggested by Antoine Falisse in this post:viewtopicPhpbb.php?f=2385&t=16844&p=0&s ... 1c2b21c15f

This is what the OpenSim Pipeline of my main.py script looks like after my modifications:

Image

I have just referred to the "gait2392_Scale_MarkerSet.xml" and "gait2392_simbody.osim" files instead of the files used in the base version.
I have pasted both these files into my opensimPipeline/Models folder.

After these adaptations to main.py, I ran the "reprocessSessions.py" script with no error, all results were successfully uploaded to S3.

My questions now are:
  • 1) Did I correctly modify the main.py script to refer to my desired MS model?
    2) How do I best check whether frontal plane knee ROM is now part of my kinematic results?
    3) How can I also use the gait2392 model for later kinetic analyses using the "example_kinetics.py" script?
    As far as I can interpret what the latter does, it seems like this script downloads the data from S3 for local analyses.
    Will the kinetic analyses thus utilize the data from the gait2392 model after running "reprocessSessions.py" successfully?
I hope these questions are noit going into too much detail.
I appreciate everyone's support!

Best

Bernhard
Attachments
Main.py adapted.png
Main.py adapted.png (77.32 KiB) Viewed 1292 times

User avatar
Antoine Falisse
Posts: 422
Joined: Wed Jan 07, 2015 2:21 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Antoine Falisse » Thu Sep 28, 2023 12:00 pm

Hey,

Nice work! A couple of ideas about you could check that you did everything right:

1. To check that your kinematic data contains the added knee dof, check the files in your local folder. When you reprocess the data locally, there should be a new folder under Data named after the session ID. there you could find the model and kinematic data. If the kinematic files contain rows for you added knee dof, then we should be able to assume that everything went fine. You can also check the paths in the setup files and see whether they point to the right model.

2. To check whether the data was correctly uploaded to the cloud, you can try to download the data using the API: https://github.com/stanfordnmbl/opencap ... encap-data and see whether everything makes sense.

3. The kinetic code currently assumes you use the default model. It would require some work from us to support gait2392. You can open an issue in the github repo and we will try to add that to our todo list: https://github.com/stanfordnmbl/opencap ... ing/issues

Two other remarks:
1. You can also add the extra dof to the default model, this would make the kinetics easier.
2. The downloaded geometry files are for the default model, so visualization on the webapp or in the opensim gui might look weird with gait2392.

Antoine

User avatar
Bernhard Faerber
Posts: 27
Joined: Thu Nov 10, 2022 1:57 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Bernhard Faerber » Fri Sep 29, 2023 10:00 am

Hi Antoine,

Thanks for the ideas, I will look into the downloaded data soon.

I have a question concerning your idea of modifying the base model:

Would this allow me to run dynamic simulations based on the modified model without any changes required to the underlying simulation setup?

Best

Bernhard

User avatar
Antoine Falisse
Posts: 422
Joined: Wed Jan 07, 2015 2:21 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Antoine Falisse » Mon Oct 02, 2023 8:51 am

Hi,

We would need to make a few changes, but it's not as heavy as supporting gait2392.

Antoine

User avatar
Bernhard Faerber
Posts: 27
Joined: Thu Nov 10, 2022 1:57 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Bernhard Faerber » Mon Oct 02, 2023 8:53 am

Hi Antoine,

That's great to hear!
I guess this will be the best way forward then.

Should I pose a request on GitHub concerning this topic?

What would be a realistic timespan for you to integrate the modified knee model?

Best,
Bernhard

User avatar
Antoine Falisse
Posts: 422
Joined: Wed Jan 07, 2015 2:21 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Antoine Falisse » Tue Oct 03, 2023 11:56 am

Sounds good, please go ahead and post an issue here: https://github.com/stanfordnmbl/opencap-processing
I will try to do it within the next month :)

Antoine

User avatar
Suzuki Misaki
Posts: 2
Joined: Wed Oct 18, 2023 7:36 pm

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Suzuki Misaki » Thu Oct 19, 2023 8:44 pm

Dear Bernhard,
I am Misaki Suzuki in Japan, and planning to use OpenCap in my research. I appreciate your trying because I want to analyze knee valgus angles too. But I I am beginner of Opensim and computer programming. Could you teach me where and how I have to change code from basic version to gait2392?
Best regards,
Misaki

User avatar
Bernhard Faerber
Posts: 27
Joined: Thu Nov 10, 2022 1:57 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Bernhard Faerber » Tue Oct 24, 2023 3:24 am

Dear Misaki,

please excuse the late reply, I have not checked the forum in a while.

I have not yet figured out a way to correctly manipulate the OpenCap Core to link the trial data to a new muskuloskeletal model.

I myself am currently trying to reprocess some sessions using the LaiUhrlich2022_KA model which would allow me to analyze knee adduction kinematics.
However, all I manage to do each time I try is to damage the files on the OpenCap servers which requires the admins to reprocess the sessions.

Maybe the LaiUhrlich2022_KA model will be implemented soon.

For the time being I am hoping for a detailed guide on how to correctly reprocess sessions locally using a new MS model.

If you find a way to successfully assign a new model I'd be interested in learning how you did it.

Best

Bernhard

User avatar
Bernhard Faerber
Posts: 27
Joined: Thu Nov 10, 2022 1:57 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Bernhard Faerber » Tue Oct 24, 2023 4:45 am

Hello everyone,

to elaborate on my response to Misaki I wanted to share the problems I am currently facing when trying to reprocess the trials from this session:
37cd3b27-0391-40e8-82bb-6b7313f42a59

Like I mentioned, I am no longer trying to use the gait 2392 model but rather the LaiUhlrich2022_KA model posted here:
https://drive.google.com/file/d/153QJQH ... 0N84L/view

The changes I've made to the OpenCap Core are as follows:

1) in changeSessionMetaData.py
--> Updated the 'openSimModel' to 'LaiUhlrich2022_KA'
--> The model is also named this way and copy-pasted into the models folder in the opensimPipeline folder
--> Results are successfully posted to S3 each time I run the script

2) in main.py (OpenSim pipeline starting @ l. 427
--> changed the pathGenericModel4Scaling to "pathGenericModel4Scaling= os.path.join(openSimPipelineDir, 'Models', 'LaiUhlrich2022_KA.osim')
--> changed the genericSetupFile4ScalingName to "genericSetupFile4ScalingName= ('Setup_scaling_RajagopalModified2016_withArms_KA.xml')
---> I wonder if this is a valid step to take. I assume the two models do not differ significantly, so I thought this might work. I have not found a generic scaling file for the LaiUhlrich2022_KA model specifically

3) in reprocessSession.py
--> insert Session ID
--> set "resolutionPoseDetection" to '1x736'

When running this code, I get the following errors:

1) For the neutral trial:
Error neutral.png
Error neutral.png (46.46 KiB) Viewed 1086 times
2) For the dynamic trials:
Error dynamic.png
Error dynamic.png (51.79 KiB) Viewed 1086 times
This results in all trial data being faulty and no longer accessible through the web app.

Any help is much appreciated as I am sure I have missed some crucial step while altering the code Thank you in advance.

Best

Bernhard

User avatar
Antoine Falisse
Posts: 422
Joined: Wed Jan 07, 2015 2:21 am

Re: Using the gait 2392 model for kinematic and kinetic analyses

Post by Antoine Falisse » Thu Oct 26, 2023 9:34 am

Hi Bernhard,

Sorry, it looks like we introduced a bug recently, which is why you were having this issue. It is fixed now (https://github.com/stanfordnmbl/opencap ... 0a851901e0) so please pull the latest code and try again.

FYI, all the steps you did make sense. For scaling, I would add an IKCoordinateTask for the knee adduction coordinates. You should then point to this different scaling setup in main.py.

Here is a complete example of what I changed: https://github.com/stanfordnmbl/opencap ... /121/files to make this all work:
- First change the session metadata
- Then run reprocessSessions after making the few changes.

You can see the different scaling setup I am using with the IKCoordinateTasks and the different msk model (that one is the one you used).

Please note that we never really tried out that model, you might need to adjust the IK setup to get meaningful results. Also, we will need to adjust the kinetic scripts to get the simulations to run (and to produce meaningful results).

hope it helps

Antoine

POST REPLY