Home › Forum › SOFA › Using SOFA › [SOLVED] How to get indices in FixedConstraint
Tagged: 64_bits, SOFA_16.12, win7
- This topic has 14 replies, 3 voices, and was last updated 7 years, 2 months ago by
Lujain.
-
AuthorPosts
-
2 May 2017 at 07:45 #9026
Lujain
BlockedHi Eveyone,
I am trying to get the indices like edges in one object. I tried one by
one and failed to get the true ones. Is there any idea to get them in SOFA
or any other third software? Here is the examples in liver.scn:
`<FixedConstraint name=”FixedConstraint” indices=”3 39 64″ />
How are the indices=”3 39 64″ from?Thanks in advance!
Lujain2 May 2017 at 16:55 #9028jnbrunet
ModeratorHi Lujain,
I’m not quite sure what you are asking here. Since you are in the “Using SOFA” subforum, I’m guessing that you want to get the indices of the FixedConstraint component linked in another component directly in the scene file? Something like this:
<FixedConstraint name=”FixedConstraint” indices=”3 39 64″ /> <PointsFromIndices name="fixed_constraint_positions" indices="@FixedConstraint.indices"/>
This will get you the positions of the constraint vertices.
If you want to get them with c++ code, you can do something like this:
sofa::component::projectiveconstraintset::FixedConstraint<DataTypes>* fc; this->getContext()->get(fc); if (fc) std::cout<<"Indices from '"<<fc->getPathName()<<"' are '"<<fc->f_indices<<"'"<<std::endl;
Output:
Indices from '/cube/FixedConstraint' are '3 39 64'
2 May 2017 at 17:12 #9029Lujain
BlockedHi jnbrunet,
Thank you so much for your reply and I am so sorry for not saying clearly.
Ok, there is a line “<FixedConstraint name=”FixedConstraint” indices=”3 39 64″ />” in the liver.scn example. If I changed “3 39 64” by another three number like “5 4 8”,I will get another three particles in runSofa. And i can also increase to more vertices,right? Now I want to extract the whole edge of the liver as the constraint, how can I know the number of these vertices expressed like “3 39 64”?2 May 2017 at 18:18 #9030Hugo
KeymasterDear Lujain,
If you want to select edges, there is, for now, no selector in SOFA. But a new GUI is in progress (see here to learn more, especially the last comment of damienmarchal). To select ids, you should be able do it in your mesh editor (e.g. Paraview, Blender).
In the scene liver.scn, the indices 3, 39 and 64 were selected before the simulation and defined as fixed constraint.
Does this help?
Best,Hugo
2 May 2017 at 18:26 #9033jnbrunet
Moderator– And i can also increase to more vertices,right?
Yes, absolutely.– Now I want to extract the whole edge of the liver as the constraint
You can use the BoxROI component :<BoxROI name="fixed_indices" box="2 4.7 -2 -4 5 2" drawBoxes="1"/> <FixedConstraint name="FixedConstraint" indices="@fixed_indices.indices" />
In SOFA, check the Behavior Model view option to draw the box. The BoxROI parameter ‘box’ is set like this:
box="x1 y1 z1 x2 y2 z2"
where (x1,y1,z1) and (x2 y2 z2) are two opposite vertices of the region of interest box.3 May 2017 at 02:17 #9039Lujain
BlockedHi Hugo,Hi jnbrunet
I am trying to solve the problem using Paraview. I am not good at this software and trying to learning. Can you give me some information in detail about getting ids? And I will try to use BoxROI to read them.
Any further progress, I will reply later.
Thanks so much for your kind help!BR,
Lujain3 May 2017 at 18:25 #9043Hugo
KeymasterOk Lujain, keep us updated.
However, it’s hard for us to help since it concerns Paraview and without your mesh.Hugo
4 May 2017 at 05:16 #9046Lujain
BlockedHi,
Here are some confusing problem.
First,I can just get the IDs of the selected ponits that I need(using Paraview、both the antirior margin and the bottom surface). There are problems when i used these ids in FixedConstraint. The position of vertices(selected ids) in behavior model are not the posiotn in my mesh. It seems to be in the up surface not the botton surface. I dont know whether SOFA did
some optimization or not.So do you think what’s the problem?
Second,when I tried using the BoxROI,i can only select coordinate of two vertices randomly. The region i got is somehow not the exact region that i want. How can I select the proper points to make right region of the BOX?<BoxROI name=”fixed_indices” box=”109.472 178.252 -281.232 -22.1038 95.1642 -335.919″ drawBoxes=”0″/> <FixedConstraint name=”FixedConstraint” indices=”@fixed_indices.indices”
Best,
Lujain18 May 2017 at 17:37 #9130Hugo
KeymasterHi Lujain
Could you provide us your mesh and your scene file ?
Your usage of BoxRoi and FixedConstraint looks right.Best
Hugo
19 May 2017 at 09:27 #9136Lujain
BlockedHi Hugo,
Sorry for late reply.
Here are mesh and scene file
I was busy to understand the algorithms in FEMforcefield cuz the deformation is not the one that I need. The liver is under pneumoperitoneum. So I guess I should do something with the component or the algorithms. As I have asked for help in programming with SOFA forum.
Can you give me some advice about both constraint and forcefield?BR,
Lujain30 May 2017 at 15:34 #9221Hugo
KeymasterHi Lujain,
the wetransfer is not active anymore. could you resend it please?
About pneumoperitoneum, it is due to pression of the thoracic diaphragm on the organs. Different modeling approach were already considered: a (periodic) surface force, sliding constraints / boundary conditions. The choice of the mechanical constitutive law (like an elastic model with co-rotational approach, or any other law) is not related to the pneumoperitoneum.
Best,
Hugo
31 May 2017 at 03:08 #923931 May 2017 at 03:27 #9240Lujain
BlockedHi Hugo,
BTW, why can’t an elastic model with co-rotational approach?
In the PH.D thesis “Augmented Reality and Numerical Simulations for Hepatic Tumors Resection” written by Rosalie Plantefeve, She told me before taht she used a corotational tetraedral FEM force field to model the liver parenchyma. And used either some plane force fields that manually placed on the anterior and superior surfaces of the liver to apply the pressure. But i dont know how to achieve that. Can you give me some tips?Thank you, Hugo!
31 May 2017 at 09:17 #9242Hugo
KeymasterHey Lujain
Everything is working fine in your scene.
You can see the fixed constraints applied:Rosalie seems to give you all the information you need: use SurfacePressureForceField or your own surface force field.
I hope this helps. For more advanced development support, you can request this as service to the consortium.
Best,
Hugo
20 June 2017 at 08:58 #9339Lujain
BlockedHi Hugo,
Your reply helps me a lot.
Thanks very much and sorry for very late reply.Best
Lujain -
AuthorPosts
- You must be logged in to reply to this topic.