Obtaining volumetric values from 3d model

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
William Lim
Posts: 3
Joined: Mon Jan 29, 2024 1:29 pm

Obtaining volumetric values from 3d model

Post by William Lim » 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?

User avatar
David Parker
Posts: 1774
Joined: Tue Aug 23, 2005 2:43 pm

Re: Obtaining volumetric values from 3d model

Post by David Parker » Fri Jan 10, 2025 11:32 am

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.
Screenshot 2025-01-10 at 9.40.47 AM.png
Screenshot 2025-01-10 at 9.40.47 AM.png (278.91 KiB) Viewed 624 times
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))
Be sure to check to make sure you are getting the correct volume, you never know with VTK.

Cheers,
Dave

User avatar
William Lim
Posts: 3
Joined: Mon Jan 29, 2024 1:29 pm

Re: Obtaining volumetric values from 3d model

Post by William Lim » Tue Jan 21, 2025 2:54 pm

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

User avatar
David Parker
Posts: 1774
Joined: Tue Aug 23, 2005 2:43 pm

Re: Obtaining volumetric values from 3d model

Post by David Parker » Tue Feb 04, 2025 11:40 am

Hi William,

Just copy the script that I posted.

Cheers,
Dave

POST REPLY