# Patient-Specific Biomedical Models Go Wild!
[fTetwild](https://wildmeshing.github.io/ftetwild/) and [PolyFEM](https://polyfem.github.io/) are further used in the field of biomechanics to generate high-quality discretized models suitable for simulation purposes. The content of the following tutorial is listed as below:
[ToC]
###### tags: `Biomedical Models`, `Jaw`, `Hip`, `Patient-Specific Models`, `Finite Element Analysis`
## Problem statement
Conventional patient-specific model generation involves different geometry and meshing processess such as cleaning-up the meshe, reducing and remeshing processes. In the conventional, all the mentioned processes are performed one-by-one on each domain independently, leading to non-conformal contacting interfaces. Such non-conformal contacting surfaces can cause non-lineartity and convergence issues especially if soft and thin structures are in contact with hard tissues which is the case in the two studies use cases in this tutorial.
## Features
By using the fTetwild as a meshing tool applied on reconstructed geometries from medical imagee, and using PolyFEM library as a FE solver, our work benefits the following features listed below:
**FTetWild**
* High quality volumetric meshes for patient-specific geometries
* With conforming meshes in the contacting interfaces
* And have control on remeshing and coarsening process for reconstructed geoemtries from medical images.
**PolyFEM**
* Uses IPC method for solving sliding contact that automatically detects the contacting surfaces with no need of any surface definition or parameter tweaking.
* Supports different element order for different domains of a mesh.
<!-- These two tutorials explain
1. How to apply [fTetwild](https://wildmeshing.github.io/ftetwild/) on medical geometries to provide
* High quality volumetric meshes for patient-specific geometries
* With conforming meshes in the contacting interfaces
* And have control on remeshing and coarsening process for reconstructed geoemtries from medical images.
2. Besides, both tutorials explain how to set up a desired scenario using JSON files and run the simulation through [PolyFEM](https://polyfem.github.io/). PolyFEM uses IPC method for solving sliding contact that automatically detects the contacting surfaces with no need of any surface definition or parameter tweaking. -->
## Known issues
Some of the known potential limitations of fTetWild and PolyFEM in the biomedical field are listed as below:
**FTetWild**
* The default filtering approaches in fTetwild may result into some meshing artifacts or spikes, hence the filtering approach need to be addapted to the task specific biomedical problems, e.g., hip or jaw models.
**PolyFEM**
* The "tied contact" is not supported in PolyFEM. Thereby it is suggested to generate the volume mesh as a multibody volume mesh, using fTetWild union operations.
* The "sliding" contacts are implemented based on IPC method that provides accurate contact definitions in the cost of a higher simulation time.
* The boundary and loading conditions can only be applied on surfaces and PolyFEM does not support node selections.
* PolyFEM is mainly used for deformable bodies. Hence, the rigid bodies in the scene should be converted to solid meshes and be an extremely stiff material should be assigned to them.
# Case studies
In this tutorial, we apply the fTetWild meshing tool on multiple anatomical structures and explain a detailed step-by-step guide of how to generate volume meshes based on their input surface mesh. The case studies include:
1. **[A Human Hip Joint Model](https://hackmd.io/JjKpih2vQHO8Od2b5R8p8Q)**
2. **[A Human Jaw Model](https://hackmd.io/9E8gPj2lTtak0m9bG8_kYQ)**
In the **hip** example, all input meshes are closed manifold meshes. Where as in the **jaw** example, the input meshes consist of both closed 3D geometries and shell surfaces used for boundary representation of a domain.
These two tutorials explain
1. How to apply **fTetwild** on medical geometries to provide
* High quality volumetric meshes for patient-specific geometries
* With conforming meshes in the contacting interfaces
* And have control on remeshing and coarsening process for reconstructed geoemtries from medical images.
2. Besides, both tutorials explain how to set up a desired scenario using JSON files and run the simulation through **PolyFEM**. PolyFEM uses IPC method for solving sliding contact that automatically detects the contacting surfaces with no need of any surface definition or parameter tweaking.
# Installation
Please refer to the [fTetwild](https://wildmeshing.github.io/ftetwild/) and [PolyFEM](https://polyfem.github.io/) to follow the installation guides.
## Impotant notes on using fTetWild
TetWild has a set of parameters which allows the user to control the mesh size and accuracy. The most common used parameters used in biomechanical studies are explained as below. You can find the full list of the features [here](https://wildmeshing.github.io/ftetwild/).
* `epsilon` : the envelope of size epsilon. Using smaller envelope preserves details better but also takes longer time. The default value of epsilon is b/1000, where b is the length of the diagonal of the bounding box.
* `edge length` : the ideal edge length. Using smaller ideal edge length gives a denser mesh but also takes longer time. The default ideal edge length is b/20.
## Output volumetric mesh
The output is a volumetric tetrahedral mesh of the expanded bounding box of the input triangle soup, with no inside/out classification. We need to apply a post-processing step to extract the interior volume of each object. The post-processing filtering step can be applied either automatically by TetWild or manually by the user. In this tutorial, we explain how to manually filter out the inner volume of the proposed examples.