Forum Replies Created
-
AuthorPosts
-
MPfeifferBlocked
Hi Hugo,
All right, the way you describe how to get the acceleration was actually the way I was using so far, I just wasn’t sure if this would let me get the acceleration at the highest possible resolution or if it’s just an approximation and SOFA has a better representation of it somewhere.
As for the force: I’m using an EulerImplicitSolver and a CGLinearSolver to solve the problem. So far I’ve been using the same method as the one you mentioned for the acceleration: f(t)/dt = (f(t) – f(t-dt))/dt
Thanks,
Micha_13 September 2017 at 09:05 in reply to: [SOLVED] Track a target point/node on a volumetric mesh #9978MPfeifferBlockedDear Siming,
The way I use the vtkProbeFilter is that I generate a regular grid of cubic elements first and then want to calculate a value from the source data for each of these cubic elements. So I want to interpolate the source data at the center of each of the cubic cells, hence the name “cellCenters”.
I’ve never used vtkImageStencil, but if you originally have a vtkPolyData you might not need to get any cell centers, you might just be able to use the vtkPolyData you already have. The vtkProbeFilter documentation says that the “point attributes are computed at the Input point positions by interpolating into the source data”, so if your vtkPolyData contains a vertex at each position where you want to sample the source data (i.e. in every image pixel/voxel), you can just use that.
Just beware that if the vtkPolyData does not describe the pixel centers and instead describes the pixel corners, you might be interpolating at the wrong positions (offset of half a pixel size).Did that answer the question?
Cheers,
Micha12 September 2017 at 14:42 in reply to: [SOLVED] Track a target point/node on a volumetric mesh #9973MPfeifferBlockedHi Siming,
If I understand you correctly, I recently did something very similar to what you are trying to accomplish. I export the SOFA result using the VTKExporter and then wrote a “voxelize” program which uses VTK to resample the results into a regular grid.
The “vtkProbeFilter” does what you want. Here’s a small excerpt from the code:// Perform the interpolation vtkSmartPointer<vtkProbeFilter> probeFilter = vtkSmartPointer<vtkProbeFilter>::New(); probeFilter->SetValidPointMaskArrayName("mesh"); probeFilter->SetSourceData( ugrid ); probeFilter->SetInputData( cellCenters ); // Interpolate 'Source' at these points probeFilter->Update();
Here, “ugrid” is a vtkUnstructuredGrid, “cellCenters” is a vtkPolyData which was previously filled with points (which can either be done manually or, if you already have the goal structure, by taking the cell centers of the image which you mentioned).
Cheers,
Micha7 September 2017 at 08:39 in reply to: [SOLVED] Export/Save displacement field of a simulation #9964MPfeifferBlockedHi Hugo,
I want to process a large amount of simulations which is why I was looking for the quickest way to get the data in the correct format. However, I will need to post-process the data anyway, so adding another step in VTK which removes the deformation and writes it into a separate array instead is not a huge deal. So no, it’s not crucial that I can do it in SOFA, it would just have been convenient.
Thanks for the quick reply, and thanks for clarifying!Cheers,
Micha6 September 2017 at 10:24 in reply to: [SOLVED] Export/Save displacement field of a simulation #9962MPfeifferBlockedHi,
I have a follow-up question:
Instead of exporting a deformed mesh, I want to export the mesh in its original form, but with a displacement field (i.e. export a displacement vector u for each point).
The goal is that when importing in Paraview the geometry of the mesh would not change but instead I would color the vertices using the displacement field.I currently have the following workaround:
Export using VTKExporter, and add “dofs.rest_position” to the “pointsDataFields”:<VTKExporter name="vtkExporter" listening="true" filename="LiverAnimation" edges="1" triangles="1" quads="1" tetras="1" hexas="1" exportEveryNumberOfSteps="1" pointsDataFields="dofs.velocity dofs.rest_position" />
Then in paraview, I can use the “calculator” filter to subtract the rest_position from the coordinates of the points, giving me the displacement.
Can this be done in SOFA instead?
-
AuthorPosts