How can I export other model file formats from Slicer?
VTK supplies classes to export some standard formats once you have a VTK model file:
vtkExporter
.
To use them, you can refer to the following example that outputs a volume in STL format.
You can type this into the tkcon
that comes up when you start Slicer.
This snippet cleans up the input model and generates triangles from it.
vtkPolyDataReader pdr
pdr SetFileName in.vtk
vtkCleanPolyData clean
clean SetInput [pdr GetOutput]
vtkTriangleFilter triangles
triangles SetInput [clean GetOutput]
vtkSTLWriter sw
sw SetFileName out.stl
sw SetInput [triangles GetOutput]
sw SetFileTypeToBinary
sw Write