Meshing separate parts in SegmentMesher

Hello all,
I use SegmentMesher to mesh two segments that are in contact with each other. The slicer gives me just one vtk file (for both segments). I know that I have to use codes such as meshio to convert these files into the format I want, but how should I separate the segments and generate their mesh separately? Because now I get just one file in the slicer for both segments.

Hello all,
I am using SegmentMesher extension to mesh two different segments that are connected to each other. Actually the reason I am using SegmentMesher is that I want a mesh that is conformal in the boundaries of two objects that are in contact (a mesh that results in having the same nodes in the boundary), and I found SegmentMesher is capable to do that. My problem is that I have to export both of the objects in one model in the slicer and then save both of them as one file (vtk or vtu). I know that I can use codes such as meshio to convert vtk file into a mesh file that can be used in FEA software, but is there any way to separate the objects that I have? Because In fact I have two objects but I get one vtk file in the slicer.

Thank you for your help.

In general, you would want to preserve shared point IDs between submeshes, but if you are sure you don’t need that then you split the mesh using this short script:

1 Like

Thank you very much for your response. I think that is exactly what I need. Can you please tell me where should I apply this code?
I am new with slicer and I am using the windows GUI.
Thanks for your help.

You can hit Ctrl-3 to bring up the Python console in Slicer and copy-paste the code there.

1 Like

It is working now. Thank you very much for your help.