Maintaining ribcage and scapula alignment after patient-specific alignment implementation

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.
POST REPLY
User avatar
Riza Bayoglu
Posts: 26
Joined: Wed Aug 02, 2023 8:54 am

Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Riza Bayoglu » Thu Oct 31, 2024 6:52 am

Hello,

I am creating patient-specific models by linearly scaling the male template model by the ratio of body heights and implementing spine alignment by modifying the orientations of the intervertebral joints. When default orientations of the disc joints are modified, the alignment of the disc levels and other model segments (scapula, ribs, arms, etc.) above the altered joint/s are changed as well. This seems to create alignment issues within the ribcage components and scapula where scapula sometimes penetrates into ribs and the ribs come into contact with each other. I attached a picture to illustrate this behavior. I was wondering to learn what the developers of this model used to maintain physiological alignment for these segments after scaling and altered spine alignment so I can create more realistic patient models. Thanks in advance.


pic.png
pic.png (262.13 KiB) Viewed 362 times

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

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Jacob J. Banks » Thu Oct 31, 2024 1:39 pm

Riza,
Yeah, this is bringing back memories (been awhile since I addressed and had to deal with this). If I recall, you have to adjust each rib the equal/opposite amount you adjust each vertebra. Then for the scapula/head etc. it is the sum all of the changes made to the spine.

I've attached the Matlab code we use for this. It isn't documented real well, and may be missing some subfunctions, but you should get the jest and the pertinent calls.

Note: this will get you back to a default alignment. If you want to adjust further, I would then customize rib or scapula alignments after doing this.

Let me know if you have any further questions or a particular custom subfunction appears crucial.
Jake Banks
Attachments
Spine_Curvature_Adj.zip
(3.42 KiB) Downloaded 49 times

User avatar
LESSBY GOMEZ
Posts: 5
Joined: Tue Mar 03, 2009 1:25 pm

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by LESSBY GOMEZ » Thu Nov 07, 2024 1:30 pm

Hi, Thank you very much for the model. I am having the same problem with scaling. I see the matlab code, but it is not clear to me how to use it. Do you have any tutorial? Thank you
Attachments
scale wrong.png
scale wrong.png (220.76 KiB) Viewed 288 times

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

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Jacob J. Banks » Thu Nov 07, 2024 3:39 pm

I believe your just having scaling issues and all that you may need to do is "lock' the ribs and spine coordinates prior to scaling (and then unlock them after).
The code I attached for Riza is for more advanced customization of models. I did not post it as a 'plug and play' type thing, rather just a means for him to see some call functions that may be useful for him.
We do not have any tutorials, sorry.
Jake Banks

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

Post by Riza Bayoglu » Wed Nov 13, 2024 12:30 pm

Hi Jake,

Thanks for the prompt reply. And, I am sorry for getting back here late. I had pressing deadlines at work and could only look at this now. I am having difficulty with fully understanding this code. Looks the patient alignment is restored in JointAngle_Orig data and it is calculated wrt. to sacrum for every vertebra. How did you calculate patient orientations for each level? In my implementation, I take into account superior endplate orientations for most levels (except T11/T12 and T12/L1 for setting exact thoracic kyphosis and lumbar lordosis values), and calculate wrt. the vertebra below instead. For example, L2/L3 coordinate is calculated as the angle between L2 and L3 superior endplates from the patient image and subtract the corresponding angle from the template model.

Also, could you please comment a bit on this part? What do XYZ2R and R2XYZ functions do?

Code: Select all

[code]Correction = repmat(-JointChange, 2, 1);
for i=1:size(JointNames3,1)    %[21:44] %ribs
		gf=0;
	OldValue = myJoints.get(JointNames3{i}).get_frames(gf).get_orientation;
			NewValueNum = str2num(char(ArrayDouble.getValuesFromVec3(OldValue)));
			Rnv = XYZ2R(NewValueNum);  %probably over complicating, but works and takes into account any non-orthongonal corrections
			Rc  = XYZ2R(Correction(i,:));
			NewValueNum = R2XYZ(Rnv*Rc);
		NewValue = ArrayDouble.createVec3(NewValueNum(1,:));
	myJoints.get(JointNames3{i}).get_frames(gf).set_orientation(NewValue);
   
end
[/code]

Can we, for example, say that to re-align T10_r10R_CVjnt joint, I will need to add all the coordinate changes from L5/S1 to/including T10/T11 and apply in the opposite direction?

Thanks again,
Riza

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

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Jacob J. Banks » Wed Nov 13, 2024 12:59 pm

This is all (admittedly) drawing on "a previous life", but I am ~certain of the following:
- The angles you put in are relative to the lower vertebrae and not Horizontal. This is how OpenSim reports angles, so that is how you have to put them in. We got (I believe; as Brett Allaire usually did this) angles from our CT scans relative to horizontal though, so that is why on Line 75 we subtract one from another to get in relation to one another.
- The XYZ2R code is just a simple code that contains 3x3 rotation sequence for X-Y-Z order. This function should be found as subfunction at the end of the code. This is making things look more complicated than they are. I could have just added things up etc., but instead I did some Matrix math (which at the time I was more familiar with).
- I am pretty sure (with you last point) you are stating that correctly. I would do this without applying any new custom rib adjustments just to see that things look correct after adjusting the vertebrae, then once you are confident in that, you can +/- patient specific values.

Sorry I couldn't be of more definitive help, but it has been a few years, and I don't have 'data' available on my current machine to rerun code.
Jake Banks

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

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Riza Bayoglu » Wed Nov 13, 2024 2:10 pm

Yes, I have the XYZ2R function from your code. It looks like you are decomposing the vertebral rotations along the z-axes into each rib joint axes since rib z-axes do not align with the global z-axis. I previously tried both, rotating rib joints along the z-axes alone vs rotate along the x,y,z axes. I had ribs penetrating each other for each case. Maybe I did not calculated the transformation correctly. Let me try to adapt your code and try again.

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

Re: Maintaining ribcage and scapula alignment after patient-specific alignment implementation

Post by Riza Bayoglu » Wed Nov 20, 2024 9:16 am

Hi Jake,

Thanks for your help. I was able to reasonable align ribcage segments. This works pretty well when the spinal alignment of a patient is not too different than the template (see patient 1 images below). However, ribs tend to point to the floor and the sternum is too far from the ribs with large differences in alignment (patient 2). Do you recall if you obtained similar re-alignment of the ribcage components? I can perhaps further adjust these patients based on their alignment parameters, i.e., rotate along the global z-axis.

Best,
Riza
Attachments
image.PNG
image.PNG (539.84 KiB) Viewed 108 times

POST REPLY