Dear Andras,
as I had troubles with FEBio, I am trying now to use the segmentation of the vertebra (in vtk format) to load into ABAQUS and do the simulation with that program. But it seems, that ABAQUS does not support vtk format (which I thought is the format for volumetric objects and also includes the HU-values from the CT-data). Do you know a cheap solution (without using another expansive software) to convert the vtk format to a format, which ABAQUS can read and without loosing the HU-values, which I think might be important to calculate the stiffness in certain points in the bone. I hope you can help me, thanks a lot in advance! Best regards Jeff
You can convert volumetric mesh from VTK format to Abaqus .inp file using the free meshio Python package.
I am not sure if material ID is included in the output file, but if you find that it is not, then you can submit a feature request to meshio.
Thanks a lot for your quick reply, even on weekend, I am impressed!
Where can I find this Python package or how can I implement it into Slicer (I have never worked with Python before)?
You can open the Python console in Slicer, type pip_install('meshio')
to download&install meshio, and you are good to go. You can find command examples for reading a mesh and writing into another format on meshio website.
Hi Andras,
thanks a lot again! I installed the newest version of 3DSlicer and was able to run pip_install(‘meshio’).
According to the documentation of meshio, I was trying to use the following syntax:
m = meshio.Mesh.read(filename, “vtk”) # same arguments as meshio.read
m.write(“foo.vtk”) # same arguments as meshio.write, besides mesh
and changed to the following:
m=meshio.Mesh.read(C:\Users\Admin\Documents\Jeffs-Data\test.vtk, “vtk”)
m.write(“output.inp”)
But unfortunately it does not work, what am I doing wrong?
What is the error message?
You may run into trouble because using backslash (\
) in Python string literals. Have a look at this post for details.
Now I have changed the backslash to (/) as Unix-type separators:
m= meshio.Mesh.read(C:/Users/Admin/Documents/Jeffs-Data/test.vtk, “vtk”)
and the following error message appeared:
m= meshio.Mesh.read(C:/Users/Admin/Documents/Jeffs-Data/test.vtk, "vtk")
^
SyntaxError: invalid syntax
You missed the quotes.
I am sorry,
what quotes do you mean?
Your filepath should have ""
s around.
Thank you all for your help! Finally I could solve the problem!
for those who have the same problem and want to exchange a .vtk to a .inp file the following steps have to be done:
- Even though there is already a newer version of Python (28.10.2020) use the version 3.7.(as an interpreter). I used PyCharme Community edition 2020.2.3 to run the following program:
import meshio
meshio.write(“output_name.inp”, meshio.read(“input_name.vtk”)) - The Python program and the .vtk file have to be in the same folder
By the way you need to install the meshio via: pip_install(‘meshio’) before running the program above
Dear Mr. Lasso,
do you maybe know, how I can check if the material ID have been included in the output file?
I could load the .inp vertebra into ABAQUS but it seems, that there is only a surfacemesh but not a volumetric mesh. Am I missing something?
Thanks a lot for your help in advance
Note that you don’t need to install anything for this (Python, PyCharm, …), but you can run these few lines directly in Slicer’s Python console, too (hit Ctrl-3 to see it).
Please check this in meshio documentation and if you don’t find any information on it then ask its developers (submit an issue and post the link to the issue here for reference).