26 April 2017 at 16 h 28 min #9003
I have generated a FEM model and a .obj model from the same .stl file and integrated them into a .scn file. However, it seems like the orientation and the origin of the FEM model (behavior model) and the .obj model (visual model) are not the same. Which mapping method should I use in this case? Barycentric Mapping seems not work (see the image data).
Siming26 April 2017 at 19 h 22 min #9004HugoKeymaster
- SOFA Consortium
If I understand it correctly, you have one .obj model for the visualization and one .stl used for the FEM model, right ?
First of all, why would your two models be not in the same configuration ?
If it comes from Dicom data, you can use the projection matrix saved in the header to register both meshes..
Hugo26 April 2017 at 23 h 19 min #9006
Well, I used 3D slicer to generate the .stl model from a DICOM volumn. Based on this .stl file, a .msh file was created with GMSH and a .obj was converted (not with GMSH) from the .stl file. I used the .msh file as MechanicalObject and the .obj file as Visual Object. Actually I expected that the .msh file and the .obj file has the same orientateion and origin, since they were generated from the same .stl model. Obviously not… So I assume this is caused by different meshing and converting algorithm. Do you think this is possible?
And also, I am not sure if I map the objects correctly to each other in SOFA. And can I use the projection matrix directly in SOFA? How?
Siming27 April 2017 at 0 h 19 min #9009HugoKeymaster
- SOFA Consortium
Yes, it is highly possible, that’s why I wrote above: Dicom images include the orientation of the image. When exporting a mesh, depending on the extension, this orientation is saved or not.
I remember there is a way to extract the orientation matrix of the Dicom image. Can you find it ?
With this orientation, you can align both .obj and .stl meshes. To do so in SOFA, you need to use the translation and rotation data of the loader (i.e. MeshObjLoader and MeshSTLLoader) you are using.
Hugo27 April 2017 at 22 h 19 min #9019
Thank you for your hints. Seems like the programm I used to convert the .stl file to .obj file changed the transformation matrix of the original .stl file. So I fix my problem finally in a more trivial way: instead of using the .obj file a the visual model, I use the .stl file as the visual model. Since the .msh file was generated from the .stl file and GMSH does not change the transformation matrix of the model by default while generate a volumetric mesh, the .msh and .stl models have the same orientation and origin, therefore aligned perfectly to each other.
Thanks for your support!!
- You must be logged in to reply to this topic.