Forum Replies Created
-
AuthorPosts
-
16 January 2017 at 18:56 in reply to: [SOLVED] Error with CImg: plugin with dependency to skeleton.h does not compile #8397RosalieBlocked
Hi Jean Nicolas !
Thanks for your help ! It works perfectly fine now.
Do you think the difference in the CMake version could also be responsible for the second problem (set image_FOUND to FALSE because SofaPython is not found)?
Rosalie
4 January 2017 at 22:40 in reply to: [SOLVED] Queries about tetrahedralization with the CGAL Plugin. #8276RosalieBlockedHi Yash
If you want to use MeshGenerationFromImage maybe my first answer to this post can be useful:
And if you want to know how to properly set the parameters of this component you can refer to the CGAL manual:
http://doc.cgal.org/latest/Mesh_3/index.html#Chapter_3D_Mesh_GenerationTo answer your question, given that a volume mesh generator always approximates the input surface, it is better to give directly the segmented image and not a surface mesh which is already an approximation of the segmented surface.
Also, be careful with the quality of your volume mesh. SOFA will not warn you if you use a poor quality mesh to perform the simulation. You must test you mesh to ensure that it is suitable for your simulation (for instance the result of the simulation should not be dependent of your mesh resolution, large dihedral angles in tetrahedra lead to discretization errors, etc.).
Hope this will help,
Rosalie10 November 2016 at 17:02 in reply to: [SOLVED] Modify origin and orientation of a mesh(oglModel) to be the same as another mesh #7768RosalieBlockedHi Albert,
I do not think that an “origin position” is stored somewhere in a .stl file. So I do not know any easy way to have the relative position of your two meshes.
However, if you know the relative position of your two meshes, in the MechanicalObject component you can specify a translation of vector [x,y,z] (translation=”x y z”) and a rotation specified by the Euler angles (rotation=”phi theta psi”). SOFA will apply first the rotation around [0,0,0] and then the translation to all the points of the MechanicalObject. You can also specify the translation and the rotation directly inside your mesh loader component.
Just out of curiosity, how do you generate your .stl files and why aren’t them aligned by default?
Rosalie
RosalieBlockedHi jjcasmar,
To solve your problem you can implement the handleEvent function of your engine to make it call the update function when you want (for instance at the beginning of each time step).
Hope this help,
Rosalie
RosalieBlockedHi jjcasmar,
Did you press the control key when you were trying to catch the letters?
Rosalie
RosalieBlockedDear Zahra,
Actually, TriangularFEMForecefield does not solve the equations, and EulerImplicitSolver alone do not solve the equations of motion either.
TriangularFEMForecefield belong to the categories of force field, as its name suggest. The only purpose of a force field is to write the equations of motion. It will construct a part of the system of equations: the stiffness matrix, even if sometimes a force field do not assemble explicitly the matrix. (You will also need a mass component to construct the mass matrix.)
The EulerImplicitSolver will construct a linearised version of the system with respect to the time.
However, a third guy is needed to finally solve the linear system: a linear solver (CGLinearSolver (which does not require the assembled stiffness matrix), SparseLDLSolver …)
Hope this help,
Rosalie
RosalieBlockedOk (just to know did you use the CGAL plugin, or your vtk file was already a mesh and thus you used only MeshVTKLoader?)
I think the best way to know how to deform a mesh in sofa is to follow the tutorials. If your mesh is composed of tetrahedra, try ForceFields/Tetrahedon FEM and “Edit in Modeler”.
Tell us if you have any problem with the tutorial.
Rosalie
RosalieBlockedHi Francesca,
First it depends if your vtk file is an image or a mesh. As you say the file is the result of a segmentation I guess it is an image. Thus, to be able to deform it in SOFA you need to convert this segmented map into a mesh. This can be done with the CGAL plugin:
1) Load the CGAL plugin
2) Create the component MeshGenerationFromImage (I give you the xml syntax):<MeshGenerationFromImage filename = "input.vtk" name = "meshGen" template = "Vec3d" facetAngle = "30" facetSize = "30" facetApproximation = "1" cellRatio = "2" cellSize = "20.0 " odt = "true" odt_max_it = "2" perturb = "true" perturb_max_time = "20.0" />
You may need to change the parameters facetAngle, facetSize, facetApproximation and cellSize depending on the size of your mesh (the values are in millimeter). I advise you to keep the other parameters (cellRatio, odt, odt_max_it, perturb, perturb_max_time) unchanged for the moment (these parameters are linked to the shape of the tetrahedra).
3) Create a mesh with the result of the previous component:
<Mesh name="mesh" points="@meshGen.outputPoints" tetras="@meshGen.outputTetras"/>
Afterwards you can create a mechanical object and a force field (TetrahedronFEMForceField for instance).
If you do it like that, the mesh will be generated each time you launch the scene (and the mesh will not be exactly the same because the mesh generation algorithm uses random seeds). To alleviate this problem you can delete the force field and use a VTKExporter:
<VTKExporter name="export_vol_mesh" exportAtBegin="1" exportAtEnd="0" triangles="true" tetras="true" filename="output" />
Then in another scene you can load your mesh with a MeshVTKLoader, create a mechanical object, a force field …
Hope this will help,
Rosalie
-
AuthorPosts