Giter Club home page Giter Club logo

meshing-with-simvascular's Introduction

Introduction

This repository contains a tutorial to convert MESH files (INRIA format) to a PolyData model, which is suitable to be used in SimVascular as a model for meshing. The sample file caroCritic_5kv.mesh (from now on referred simply as mesh) contains the mesh that is being used in this tutorial.

Preparing the mesh

To obtain the PolyData model, we need to convert first the MESH file to vtk. However, before converting the mesh, we needed to remove all the fields that are not used by SimVascular. Otherwise, the software could crash at meshing step. The fields to be removed are:

  • Tetrahedra
  • Normals
  • NormalAtVertices
  • Tangents
  • TangentAtVertices
  • Edges
  • Ridges

Leaving only the fields Triangles and Points.

The mesh conversion to vtk is done using meshio as follows:

meshio convert caroCritic_5kv.mesh caroCritic_5kv.vtk

Converting the mesh to PolyData

The conversion from the vtk file to PolyData is done by running the Python script vtk2vtp.py, which uses the vtk Python module to import, extract the information, and store the model. To execute the instructions, just run:

python3 vtk2vtp.py

Meshing with SimVascular

  1. Open SimVascular and create a new project under File/Create SV Project or by pressing ctrl + N.

  2. Under the SV Data Manager tab, right-click model and click on Import Solid Model and choose the PolyData file (caroCritic_5kv.vtp) obtained in the previous step.

color picker

  1. Select the carotid model and open the SV Modeling tab. Then, click on Extract and Extract Faces to obtain the surface faces.

color picker

  1. Now select all the generated faces and click on Combine, which will combine all the faces into one. Then, select the single face and repeat step 3. Important: idk why but, if this step is not performed, SimVascular could give an error message during mesh generation.

color picker

  1. Explore the generated faces and choose their type (wall or caps). And then, under the SV Data Manager tab, right-click Meshes and click Create Mesh and press enter.

color picker

  1. Chose the created mesh and open the SV Meshing tab, choose a Global Max. Edge Size and click Run Mesher. There are several meshing options that can be defined by the user not covered in this tutorial.

color picker

  1. To export the generated mesh, right-click the mesh under the SV Data Manager tab and click Export Mesh-Complete and choose the destination path.

Converting the generated mesh to other formats

The script given in convert_data.py allows converting the mesh exported from SimVascular to other formats (e.g., vtk, xdmf, INRIA mesh, etc). The code given is based on the vtk Python library and meshio. To convert the output, simply change the path in the script and run it using:

python3 convert_data.py

Dependencies

Contributors

meshing-with-simvascular's People

Contributors

hmella avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.