Page 1 of 1

Custom geometry alignment

Posted: Tue Jan 23, 2024 3:35 pm
by alexdenton
Hello,

I am working on replacing the skeletal geometry of gaitModel2392 with a custom geometry set. Unfortunately, the files from the custom geometry do not load in the proper orientation or location. The software used to create the custom geometry must have a different global reference system. However, the resulting .obj files do not directly or concisely describe the orientation and location, as is the nature of .obj files.

I understand geometries are simply a visual representation, but I would like to use the custom geometries as alternative to the scaling tool because I do not have traditional marker data.

What is the best process for correctly implementing custom geometry to an existing model? Scouring the forum, I saw a few similar posts from several years ago with no clear resolution. Thought I would give it another try.

Attached is an example image of the issue- gaitModel2392 with only a custom right femur geometry.

Thank you.

Re: Custom geometry alignment

Posted: Wed Jan 24, 2024 4:56 am
by evajing
Hello Alex,

I've been also trying to replace some parts of generic model with patient-specific geometries. And I met the same problem with you. The model .stl could not be displayed in correct dimension, orientation or location in the coordinate system of generic musculoskeletal model, cf. image attached.

Looking forward to some solutions.

Best regards,
Jing

Re: Custom geometry alignment

Posted: Wed Jan 24, 2024 7:27 am
by kernalnet
Hi,

I had done similar thing by transforming the geometry relative to the ground origin in a mesh editing software (e.g. MeshMixer). This origin then will be considered as local coordinate system for that segment. In this case, the origin would be the center of femoral head. A good practice is to open both geometry files simultaneously and try to fit your model from a same origin as much as possible.

You may also want to use OpenSim Creator for creating/modifying models. But if body scaling [not muscles and joints personalization] is your only purpose, I think manual scaling through OpenSim Scale tool could be a better and much more convenient alternative; because it can scale other components (e.g. wrapping geometries) and adjust muscles' points as well. In this case, you only need to compute a scaling factor from the dimensions of the subject geometry relative to the generic model geometry. You can put markers at the proximal and distal of segments or joints centers and measure the length of the model's segments. Please see how to implement Manual Scaling Factors.

There are also some other tools, such as STAPLE and MAP Client, that can help you build a subject-specific OpenSim model with your geometries. It seems that all are being actively maintained and developed.

Hope this helps,
-Mohammadreza

Re: Custom geometry alignment

Posted: Thu Jan 25, 2024 1:27 pm
by alexdenton
Jing-
Thank you for sharing your experience. It is great to know a solution would be useful to other OpenSim users.

Mohammadreza-
Thank you for your detailed response. I neglected to mention I explored OpenSim Creator in my first approach but was not satisfied with the seemingly tedious process of re-aligning the geometries and re-creating muscle paths, joints, etc.

I agree an OpenSim virtual marker-based approach would be a solution, though it may not be the best approach for scaling many segments for multiple participants.

Thank you for bringing STAPLE and MAP Client to my attention. They seem to be very interesting tools. I tried STAPLE for my application but found it challenging to merge muscles and joints between models. Full disclosure, I did not explore STAPLE in great detail.

The solution I found worked best for this task was to create a MATLAB script that calculates scale factors between the original geometry of a segment and the new geometry of a segment using the bounding box, which is then integrated into the model. I will plan on sharing my MATLAB script soon, and maybe create a more complete version with examples on a SimTK page at a later date.

I appreciate your suggestions.