subject-specific implementation of pelvic alignment

Provide a musculoskeletal model of the full thoracolumbar spine and rib cage for researchers to use in their investigations of spine and thorax kinematics and dynamics.
User avatar
Riza Bayoglu
Posts: 26
Joined: Wed Aug 02, 2023 8:54 am

Re: subject-specific implementation of pelvic alignment

Post by Riza Bayoglu » Fri Apr 05, 2024 3:30 pm

Hi Jacob,

Thanks for the comment. I tried different things, but I am having difficulty figuring this out and understanding the solution you suggested. Since sacrum rotates relative to the cs. (superior one in the attached picture), sacrum position seems off when we set PI values around 60 deg. We can technically adjust the translational positions of the pelvis_offset frame of the pelvis_sacrum joint. But, this is going to require several manual iterations to nicely position the sacrum and probably won't be feasible to automate for large datasets. I also realized the coordinate systems in your picture seem different than mine, I can't tell why. The superior one is for the pelvis_sacrum joint, the inferior one is for the ground_pelvis joint.

You mentioned you previously used Matlab API to automate setting spino-pelvic parameters for larger datasets. Will it be possible to share this code? I can perhaps check it out and see the implementation.

If I need to, how can I re-define the location of the pelvis_sacrum joint to be at the mid-sacrum point?

Thank you.
Capture.PNG
Capture.PNG (14.64 KiB) Viewed 2283 times

User avatar
Jacob J. Banks
Posts: 97
Joined: Tue Jul 15, 2014 5:17 am

Re: subject-specific implementation of pelvic alignment

Post by Jacob J. Banks » Mon Apr 08, 2024 8:53 am

Riza,
See if this does what you want... I think it may. Admittedly, I was/am a little rusty with API coding. My current role doesn't require much of it. So, it was fun to piece together old code and be reminded of what I once 2nd nature for me.

I recommend using the model I attached in this folder for playing around. I simply removed all the muscles, so it opens/closes much faster.

I won't say much more (now). Will let you look at the code and see if it works for you. I tried to add comments and explain things, but otherwise it is pretty simple. I just rotate the sacrum, and then move it back to it's original linear location (based on the L5 origin, as this is cleaner than using the Sacrum).

Sorry, it is MATLAB. Not a Python guy. But from my experience, most of this code should translate. Let me know how it goes.
Jake Banks
PS: I recall the only 'easy' way of changing the axis location of the sacrum requires changing the .vtp graphics file, which is sort of a pain. Otherwise, it shouldn't be too bad. I have done this along a time ago (as well). I think the attached code works, so hopefully this won't have to occur, but it is an option.
Attachments
Sacrum_Adj.zip
(31.98 KiB) Downloaded 116 times

User avatar
Riza Bayoglu
Posts: 26
Joined: Wed Aug 02, 2023 8:54 am

Re: subject-specific implementation of pelvic alignment

Post by Riza Bayoglu » Mon Apr 08, 2024 4:49 pm

Hi Jacob,

Thanks so much for sharing this code, it worked like a charm! I can now set patient-specific pelvic parameters automatically through Python scripting. I modified some coding bits because some were depreciated in the OpenSim version I am using, and most lines worked just fine in Python. When I initially removed artificial sacrum translation using L5 position, there were around 0.5-2 degrees of error in PT and PI depending on the sacral slope inclination. Instead, I used the marker position at mid-sacrum point, and I was able to set exact values. I am glad I did not need to change the base model architecture. Thanks again, I really appreciate it!

User avatar
Jacob J. Banks
Posts: 97
Joined: Tue Jul 15, 2014 5:17 am

Re: subject-specific implementation of pelvic alignment

Post by Jacob J. Banks » Tue Apr 09, 2024 5:48 am

Good deal. Glad to hear it.
Let me know if there is anything else.
Jake Banks

User avatar
karlijn Spijker
Posts: 6
Joined: Mon Jan 15, 2024 7:33 am

Re: subject-specific implementation of pelvic alignment

Post by karlijn Spijker » Thu May 16, 2024 6:16 am

jbanks wrote:
Mon Apr 08, 2024 8:53 am
Riza,
See if this does what you want... I think it may. Admittedly, I was/am a little rusty with API coding. My current role doesn't require much of it. So, it was fun to piece together old code and be reminded of what I once 2nd nature for me.

I recommend using the model I attached in this folder for playing around. I simply removed all the muscles, so it opens/closes much faster.

I won't say much more (now). Will let you look at the code and see if it works for you. I tried to add comments and explain things, but otherwise it is pretty simple. I just rotate the sacrum, and then move it back to it's original linear location (based on the L5 origin, as this is cleaner than using the Sacrum).

Sorry, it is MATLAB. Not a Python guy. But from my experience, most of this code should translate. Let me know how it goes.
Jake Banks
PS: I recall the only 'easy' way of changing the axis location of the sacrum requires changing the .vtp graphics file, which is sort of a pain. Otherwise, it shouldn't be too bad. I have done this along a time ago (as well). I think the attached code works, so hopefully this won't have to occur, but it is an option.
Hello,

I was reading this post and see some things that might be interesting for my project. I only still have some problem, I was wondering if you can help me with this?

For my project I am trying to patient specific model based on MRI scans.
I was trying to use this matlab code to first change the spinal alignment of one of the child models (which are based on this model) based on some MRI images. I am using the the following joint names and bodynames. (as the child model do not have markers I can not use the markers as reference)

JointNames = {'L5_S1_IVDjnt', 'L4_L5_IVDjnt', 'L3_L4_IVDjnt', 'L2_L3_IVDjnt', 'L1_L2_IVDjnt', ...
'T12_L1_IVDjnt', 'T11_T12_IVDjnt', 'T10_T11_IVDjnt', 'T9_T10_IVDjnt', ...
'T8_T9_IVDjnt', 'T7_T8_IVDjnt', 'T6_T7_IVDjnt', 'T5_T6_IVDjnt', ...
'T4_T5_IVDjnt', 'T3_T4_IVDjnt', 'T2_T3_IVDjnt', 'T1_T2_IVDjnt'};

BodyNames = {'lumbar5', 'lumbar4', 'lumbar3', 'lumbar2', 'lumbar1', ...
'thoracic12', 'thoracic11', 'thoracic10', 'thoracic9', ...
'thoracic8', 'thoracic7', 'thoracic6', 'thoracic5', ...
'thoracic4', 'thoracic3', 'thoracic2', 'thoracic1'};

However the results are not that good yet, it seems the vertebrae are all gone when I open the model in openSim. I think maybe there is something wrong with the JointNames and BodyNames combination? Can you maybe help met with this? What can best use as reference?

You mentioned that you commonly change joint angles for spine curvature (from CT scans of vertebral angles), with a written API Matlab scripts to automate it for larger datasets.I think the orientation/rotation of the vertebrae is also determined automatic? Can you maybe explain how you have done this?

I hope you can help me with this if you have time.

Thanks,
Karlijn Spijker

User avatar
Jacob J. Banks
Posts: 97
Joined: Tue Jul 15, 2014 5:17 am

Re: subject-specific implementation of pelvic alignment

Post by Jacob J. Banks » Thu May 16, 2024 6:33 am

I would suggest looking at the sample code I provided Riza (a few messages above). That should give you the methods to adjust bodies/joints manually via an API. You need to use OpenSim specific syntax when calling things. Otherwise, try manually adjusting things via a text editor to get a feel for things.
Let me know how things go.
Jake Banks

User avatar
karlijn Spijker
Posts: 6
Joined: Mon Jan 15, 2024 7:33 am

Re: subject-specific implementation of pelvic alignment

Post by karlijn Spijker » Thu May 23, 2024 7:13 am

Hi,

Thanks for the reply. I figured out how to change the joint angles in the model given a list of joint angles in matlab.

I am currently trying to find the best way to get the angles from my MRI scan. I have read many articles and I think the best way (for my MRI images) is to select 4 landmarks in sagittal and coronal plane, as shown in the figure, and calculate the angels from this measurements. In this was I can change sagittal and coronal alignment in the model.
Later, I will look more into axial alignment, changing dimensions and locations using the MRI images.

I was wondering if you used the same method for the CT scans to change the orientation or if you have some better suggestion?

Thanks,
Karlijn
Attachments
Capture.PNG
Capture.PNG (48.7 KiB) Viewed 1800 times

User avatar
Jacob J. Banks
Posts: 97
Joined: Tue Jul 15, 2014 5:17 am

Re: subject-specific implementation of pelvic alignment

Post by Jacob J. Banks » Thu May 23, 2024 10:09 am

I'm not the one to ask (Brett Allaire does most of that for the Anderson group), but that sounds right.
I've attached a picture of how/when the process was explained to me. Hopefully this helps, otherwise I could give you Brett's contact info.
Jake Banks
Attachments
Picture1.png
Picture1.png (52.13 KiB) Viewed 1795 times

User avatar
karlijn Spijker
Posts: 6
Joined: Mon Jan 15, 2024 7:33 am

Re: subject-specific implementation of pelvic alignment

Post by karlijn Spijker » Mon May 27, 2024 3:13 am

Hi,

Thanks it seems clear to me. Thanks!

Karlijn Spijker

POST REPLY