Saving a VTK model in a certain directory using Python


Is there a way to save a .vtk file in a specific directory using Python? I would like to include this functionality in my script but could not find a good way to do it.

Thank you!

Chad Paik

slicer.util.saveNode will work for saving model nodes to .vtk files. Is that what you are trying to do?

slicer.util.saveNode(modelNode, ‘/path/of/file.vtk’)

You will need to specify the full path in order to put it in an arbitrary location.

Yes! This is exactly what I was looking for!

Thank you :slight_smile: