# Exporting segmentation to Abaqus

**URL:** <https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974>\
**Category:** Support\
**Tags:** segmentation, fem\
**Created:** [October 10, 2020, 1:23pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974 "2020-10-10T13:23:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 10, 2020, 1:23pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/1 "2020-10-10T13:23:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 10, 2020, 2:34pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/2 "2020-10-10T14:34:51Z")

</div>

You can convert volumetric mesh from VTK format to Abaqus .inp file using the free [meshio](https://github.com/nschloe/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.

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 10, 2020, 2:42pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/3 "2020-10-10T14:42:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 10, 2020, 2:57pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/4 "2020-10-10T14:57:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 13, 2020, 3:01pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/5 "2020-10-13T15:01:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 13, 2020, 4:04pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/6 "2020-10-13T16:04:21Z")

</div>

What is the error message?

You may run into trouble because using backslash (`\`) in Python string literals. Have a look at [this post](https://discourse.slicer.org/t/subprocess-call-does-not-work/2837/14) for details.

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 17, 2020, 12:46pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/7 "2020-10-17T12:46:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 17, 2020, 1:37pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/8 "2020-10-17T13:37:40Z")

</div>

You missed the quotes.

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 17, 2020, 2:09pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/9 "2020-10-17T14:09:29Z")

</div>

I am sorry,  
what quotes do you mean?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 18, 2020, 8:34pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/10 "2020-10-18T20:34:36Z")

</div>

> [@Jeff\_S](#):
>
> `m= meshio.Mesh.read(C:/Users/Admin/Documents/Jeffs-Data/test.vtk, "vtk")`

Your filepath should have `""`s around.

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 28, 2020, 12:12pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/11 "2020-10-28T12:12:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeff\_S](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_s/32/6146_2.png) [@Jeff\_S](https://discourse.slicer.org/u/Jeff_S)\
**Post date:** [October 28, 2020, 12:16pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/12 "2020-10-28T12:16:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 28, 2020, 12:58pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/13 "2020-10-28T12:58:24Z")

</div>

> [@Jeff\_S](#):
>
> import meshio  
> meshio.write(“output\_name.inp”, meshio.read(“input\_name.vtk”))

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

> [@Jeff\_S](#):
>
> do you maybe know, how I can check if the material ID have been included in the output file?

Please check this in meshio documentation and if you don’t find any information on it then ask its developers (submit an [issue](https://github.com/nschloe/meshio/issues) and post the link to the issue here for reference).

---

<div class="post-metadata">

**Author:** ![Tom\_F-T](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tom_f-t/32/81964_2.png) [@Tom\_F-T](https://discourse.slicer.org/u/Tom_F-T)\
**Post date:** [April 17, 2026, 2:29pm UTC](https://discourse.slicer.org/t/exporting-segmentation-to-abaqus/13974/14 "2026-04-17T14:29:17Z")

</div>

Hi Mr. Lasso,

Ive been having a similar issue with my own work, as I have a model that I wish to import to Abaqus, however the first time I did this it opened as a surface mesh and as such I couldn’t apply sections to the model. Ive been trying to use the meshio package to convert it into an .inp file as mentioned in [this forum discussion](https://discourse.slicer.org/t/convert-a-surface-mesh-to-a-volumetric-mesh-in-3d-slicer/1416/15), but I am struggling in the python console as i keep getting the error that it cannot read my .vtk file as a vtk, as shown below

> > > import meshio

\>\>\> input\_vtk = r"C:\Users\tomyf\OneDrive - Loughborough University\Desktop\Specimen1\_VOI4\_Scan1\_1.vtk"

\>\>\> mesh = meshio.read(input\_vtk)

Error: Couldn’t read file C:\Users\tomyf\OneDrive - Loughborough

University\Desktop\Specimen1\_VOI4\_Scan1\_1.vtk as vtk  
Any help would be greatly appreciated.
