I want to deform a 3D model using itk’s FEM module. For this I have implemented the following workflow:
Read CT data-set and create 3D iso-surface using vtkMarchingCubes (output is polydata)
Extracted the interested surface using vtkHardwareSelector (output is 2D polydata)
Converted the extracted surface to the unstructured gird using vtkUnstructuredGrid and vtkDelaunay3D in order to get a 3D tetrahedron as unstructured grid (output is 3D unstructured grid)
Converted the unstructured grid to the itk mesh, which contains tetrahedron cells (output is itkMesh object)
To convert the itk mesh to the FEM model, I have created FEM object (FEMObject<3>), which contains a material (MaterialLinearElasticity), elements and nodes (Element3DC0LinearTetrahedronStrain), boundary conditions within force (LoadBC) and to generate a solution for the formulation, I have created a solver (FEMSolver<3>).
My problem is:
If I call the update of solver “solver->Update()” I get the warnings “/itk-4.7.2/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_qr.txx: vnl_qr::solve() : matrix is rank-deficient by 3” and generated solutions are just zeros.
Ok I found my problem. It was by creating the nodes. For my case; the node coordinates should be defined from itkMesh and saved in a 3D Vector. Then set as coordinate for nodes.
Now I want to ask. Is there any possibility to convert the deformed fem object to the vtk (e.g. polydata or unstructured grid), without saving it as meta object?
I have another question. If I want to replace the old node coordinates with the new one after solution, in order to visualize the deformation,I get zeros as solution values in (m_ls->GetSolutionValue(node->GetDegreeOfFreedom(j)).
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem New Node : 0 Coordinates: -60.090999603271484375 -139.6909942626953125 209.5
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem New Node : 1 Coordinates: -59.80970001220703125 -140.121002197265625 209.5
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem New Node : 2 Coordinates: -59.785198211669921875 -139.6909942626953125 208.7949981689453125
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem New Node : 3 Coordinates: -60.214801788330078125 -139.261993408203125 209.11700439453125
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem Solution Vector: 0
TETRAHEDRON_CELL Fem New Node : 4 Coordinates: -60.36569976806640625 -139.261993408203125 209.5
As you see the old and new node coordinates are the same, because the solution vector gives me zeros, although I have some displacements in solution.
Or should I may be fill the replacedNodeVector with the old node coordinate + Solution for the specified node. like:
If you want to visualize mesh deformation, why do you want to change it?
To have a chance of somebody debug this for you, you need to provide a runnable example with input data. Also, make it a new thread for better visibility on the forum.