Obtaining volumetric values from 3d model
- William Lim
- Posts: 3
- Joined: Mon Jan 29, 2024 1:29 pm
Obtaining volumetric values from 3d model
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?
- David Parker
- Posts: 1774
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Obtaining volumetric values from 3d model
Hello,
SV does not compute vessel volumes, will need to do this manually.
You will need to first write out the lofted surface for a vessel to a VTK VTP file from the Segmentations Tool.
You can then write a Python script using the vtk package to compute the volume, something like
Be sure to check to make sure you are getting the correct volume, you never know with VTK.
Cheers,
Dave
SV does not compute vessel volumes, will need to do this manually.
You will need to first write out the lofted surface for a vessel to a VTK VTP file from the Segmentations Tool.
You can then write a Python script using the vtk package to compute the volume, something like
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))
Cheers,
Dave
- William Lim
- Posts: 3
- Joined: Mon Jan 29, 2024 1:29 pm
Re: Obtaining volumetric values from 3d model
Hi Dave,
Thank you so much for the information. Would you be able to share the python script with me?
Here is my email: wlim1704@gmail.com
Best,
William Lim
Thank you so much for the information. Would you be able to share the python script with me?
Here is my email: wlim1704@gmail.com
Best,
William Lim
- David Parker
- Posts: 1774
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Obtaining volumetric values from 3d model
Hi William,
Just copy the script that I posted.
Cheers,
Dave
Just copy the script that I posted.
Cheers,
Dave