Exporting segmentation to Abaqus

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)?

1 Like

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.