VTK file visualization and surface/volume mesh extraction


I have a output vtk file from a program that i need to use to create a surface mesh. Some, issues i am having is loading the file in slicer shows strands of surface instead of a clean/connected surface. Changing the view to wireframe does shows lines connecting parts where there is no surface in the viewport. The missing surfaces does not appear when it is opened in paraview. As a result i am not sure if my geometry is clean or not. This is important since i need to create a mesh for my subsequent analysis.

This bring me to my second question. Can we create a mesh file (obj/stl) from vtk file in slicer. I tried using the save module but the only option available to me are vtk and vtu. I visualized the vtk file through the “models” module

Most likely your mesh contains incorrectly oriented triangles. Older Slicer versions by default did not show backface of triangles. You can enable display of both sides in Models module / Display / 3D Display / Visible Sides → All. Current Slicer versions show both sides by default and contain many other fixes, so most likely they will show the full mesh by default.

A .vtk file can contain an image, surface mesh, or volumetric mesh. If Slicer only offers to save a model in .vtk and .vtu (unstructured grid) format then it means that the model contains a volumetric mesh, which cannot be saved as a surface mesh (.stl, .obj, .ply, … formats).

You can convert your volumetric mesh to a surface mesh by copy-pasting this code snippet into the Python console (replace Model by the name of your model node):