Obtaining volumetric values from 3d model
Posted: Thu Jan 09, 2025 9:06 pm
Is there a function or way to find the volume of the vessel from the specific 3D model within SimVascular? If not what are some other options?
A short text to describe your forum
https://simtk.org/plugins/phpBB/
Code: Select all
import vtk
if __name__ == '__main__':
file_name = sys.argv[1]
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName(file_name)
reader.Update()
lofted_model = reader.GetOutput()
fill_hole_filter = vtk.vtkFillHolesFilter()
fill_hole_filter.SetInputData(lofted_model)
fill_hole_filter.SetHoleSize(float(1e10))
fill_hole_filter.Update()
volume_model = fill_hole_filter.GetOutput()
mass_props = vtk.vtkMassProperties()
mass_props.SetInputData(volume_model)
mass_props.Update()
surf_area = mass_props.GetSurfaceArea()
print("Model surface area: {0:f}".format(surf_area))
volume = mass_props.GetVolume()
print("Model volume: {0:f}".format(volume))