Provides a system for patient-specific cardiovascular modeling and simulation.
-
Akash Gupta
- Posts: 16
- Joined: Thu Jun 09, 2016 6:58 am
Post
by Akash Gupta » Thu Jul 11, 2024 9:55 am
Hello,
I have a bunch of patient geometries that I need to mesh, and I'd like to script the meshing process. Are there any example scripts that I could refer to that would do the following:
- Export surface and volume meshes
I've seached this forum, and I've found links to scripts in the SimVascular-Tests Github repository for meshing. I'm not sure of how to import the stl and generate faces though. Also, the repository seems to be about 3 years old now. Are there any up to date example scripts available? Thanks!
-
Akash Gupta
- Posts: 16
- Joined: Thu Jun 09, 2016 6:58 am
Post
by Akash Gupta » Thu Jul 11, 2024 11:47 am
Thank you for the quick reply! These are patient geometries so it's something I have to work with. If I could control the file format for my models, which ones would work best with SimVascular?
-
David Parker
- Posts: 1680
- Joined: Tue Aug 23, 2005 2:43 pm
Post
by David Parker » Thu Jul 11, 2024 2:10 pm
Hello,
It is not really the file format that matters but the geometry (triangles) that are stored there. The geometry obtained from imaging data needs to be well-defined: manifold, no zero areas, decent aspect ratios.
Cheers,
Dave
-
Akash Gupta
- Posts: 16
- Joined: Thu Jun 09, 2016 6:58 am
Post
by Akash Gupta » Wed Aug 07, 2024 3:39 pm
Hello,
I had a follow up question about writing out the mesh files. I've managed to execute the python script file you had suggested in for tetgen meshing at:
https://github.com/SimVascular/SimVascu ... l-model.py.
The script exports the generated mesh as a volume mesh (vtu) only. I also need the faces to be exported as surface meshes (vtp) files with facenames(vtp.facenames) info. I've looked up the SimVascular Python documentation for the TetGen class and I couldn't find an option to export the extracted faces as surface meshes. In the older versions of SimVascular, the surface and volume meshes were written out during meshing.
Do you have any examples or suggestions to make this possible with the Python interface?
Thanks!
-
David Parker
- Posts: 1680
- Joined: Tue Aug 23, 2005 2:43 pm
Post
by David Parker » Fri Aug 09, 2024 1:54 pm
Hello,
The TetGen (see
https://simvascular.github.io/documenta ... ing_module) describes the
get_surface() method for the TetGen class that returns a vtkPolyData object containing the surface mesh with face IDs.
Code: Select all
mesh_surface = mesher.get_surface()
file_name = "cylinder-mesh.vtp"
writer = vtk.vtkXMLPolyDataWriter()
writer.SetFileName(file_name)
writer.SetInputData(mesh_surface)
writer.Update()
writer.Write()
And the
tetgen-set-stl-model.py script uses the
get_model_polydata() method to extract the surface mesh for a face
Code: Select all
face1_polydata = mesher.get_face_polydata(1)
gr.add_geometry(renderer, face1_polydata, color=[1.0, 0.0, 0.0], wire=False, edges=True)
Cheers,
Dave