Converting images to meshes


I am currently trying to groom my segmentation images and then export them to volume files, I saw it is possible using the command line image-to-mesh, but I want to automatize it on a python code, is there a way to call this function in Python please ?

Thank you

If you want to convert your groomed image into mesh in Python, you can do:

import shapeworks as sw

img = sw.Image(<path to input image>)
# perform image grooming
mesh = img.toMesh() # convert image to mesh
mesh.write(<path to output file>) # writing out the mesh