I am a beginner and I don’t have much experience with the 3DSlicer environment and vtk libraries. I have already followed the various tutorials to get started.
My problem is the following.
I am trying to use python to retrieve model information, particularly Surface Area and Volume.
The ModelNode in my case is a Surface Mesh (vtkPolyData).
From here, how do I get easily Surface Area and Volume?
I don’t know if this is the best approach but I found the solution for my problem using the vtkMassProperties
Mass = vtk.vtkMassProperties()
I hope this can be of help to someone.
Pass the polydata to vtkMassProperties, and the rest is quite straightforward.
If you check Slicer’s code they pass the polydata by a triangleFilter with a specific option before using massProperties. I don’t know why they do it but when I have to calculate a surfaceArea or volume I do it too
Hope it helps