Compact, automated pipeline to simulate tongue reconstruction with free flaps: biomechanically optimized flap design (hiFEM), virtual suturing, and long-term atrophy, at patient-specific scale. Currently, built for researchers doing VSP for soft-tissue surgery who need reproducible, high-throughput studies and pre-op scenario testing.
- Automatic model generation from two meshes: baseline tongue and planned resection. No manual meshing steps.
- Biomechanically optimized planar flap design (hiFEM) with deterministic 3D↔2D mapping for texture/point correspondence.
- Multilayer flap assembly (skin + adipose) and congruent tet meshing via fTetWild; elevation to tet10 for accuracy and stability.
- Virtual suturing: distributed suture forces, sticky/penalty contacts, rigid mandible boundary, gravity; immediate viscoelastic relaxation to Day-0 state.
- Post-op remodeling: adipose atrophy via kinematic growth to estimate ~1-year neotongue anatomy and strains.
- Batch experimentation: full-factorial sweeps over flap stiffness (donor site) and overbulking via
configs/parameter_grid.csv. - Robustness at scale: implicit FEBio solver, adaptive meshing, tuned contact, mesh convergence-validated settings.
- Currently only Windows implementation is tested.
main.py— end-to-end runner; executes a list of simulations (120 lines) defined inconfigs/parameter_grid.csv.src/— hiFEM template design, suturing + FEBio I/O, tet meshing utilities, 2D/3D processing, volume flattening.inputs_A/… inputs_D/— example case folders with required OBJ inputs.fTetWild/— Windows binary for tetrahedral meshing (FloatTetwild_bin.exe).configs/parameter_grid.csv— factorial study parameters (cases, stiffness, overbulking, etc.).
- Create environment and install dependencies
uv venv
uv sync- Install FEBio (required runtime)
- Install FEBio Studio 2.9 and ensure the executable exists at the path:
C:\\Program Files\\FEBioStudio\\bin\\febio4.exe
- OR use a different path; edit
FEBIO4_EXE_PATHnear the top ofmain.py.
- Run the main.py
uv run python main.pyOptional: run a single experiment (example at bottom of main.py), or reduce the grid by filtering rows in configs/parameter_grid.csv.
Outputs are written to outputs_<experiment_id>/ for each row in configs/parameter_grid.csv.
Each case folder (e.g., inputs_A) must contain these OBJ files:
native_tongue.obj— baseline anatomyresection.obj— planned resection volumetongue_resected.obj— tongue after boolean resection (native_tongue minus resection)surf3D.obj— resection boundary surface used by hiFEM (outher surface of theresection.obj)mandible.obj— rigid reference for boundary conditionsfixed_nodes.obj— region to fix at anatomical attachmentstongue_flap_interface.obj— interface surface for sticky contact
Key outputs per experiment (in outputs_<experiment_id>/):
- Intermediate visuals: HTML snapshots of meshing, sutures, contacts.
- Intermediate models: VTK snapshots.
- FEBio job:
Simul.feb. - FEBio results:
Simul.xplt, logs, andSimul_metrics.json(runtime and mesh stats).
Parameters are defined per row in configs/parameter_grid.csv:
experiment_id— unique name; becomes the output folder suffixinputs_folder— one ofinputs_A … inputs_D- Flap material properties (Ogden skin):
skin_mu1,skin_mu2,skin_alpha1,skin_alpha2 - Geometry:
skin_thickness_mm,fat_volume_scale(controls overbulking),suture_every_n_mm - Meshing/performance:
mesh_levelin {i,ii,iii,iv} (adapts tet sizes and suture influence radius)
Notes
- Donor-site “stiffness levels” are realized via Ogden parameters (forearm vs thigh) calibrated from literature.
- Overbulking is modeled by increasing adipose thickness; atrophy (default study used ~40%) is applied via kinematic growth.
- hiFEM generates a biomechanically optimized planar flap template with 3D↔2D node mapping.
- Volume flattening builds a 3D free flap model congruent to the template; multilayer flap (skin+fat) is formed.
- fTetWild builds tet meshes; meshes are elevated to tet10 and partitioned into skin/fat.
- Suturing is simulated by distributed springs around sampled edge points; sticky/penalty contacts resolve interfaces.
- A brief viscoelastic relaxation yields Day‑0; adipose atrophy runs to an estimated ~1‑year state.
- Metrics are computed for anatomy restoration and native-tissue strain.
- Tested only on Windows and Python 3.11
- FEBio version 2.9 (CLI:
febio4.exe) - fTetWild: a Windows binary is provided in
fTetWild/. For other operating systems, please compile FloatTetwild or obtain a precompiled binary. (Note: theFloatTetwild_bin.exeCLI gives necessary control for congruent multilayer meshing) - Python deps: see
requirements.txt(plusconfmapfrom GitHub). PyVista with trame enables exported HTML views.
If you use this repository in academic work, please cite the study describing the workflow and factorial analysis:
Isazadeh AR, Westover L, Seikaly H, Aalto D. Computational Analysis of Tongue Reconstruction Surgery: The Impact of Free Flap Site and Volume on the Tongue Anatomy and Biomechanics. 2025. Under review.
This project is released under the terms of the LICENSE in this repository.
Third-party software included or required by this project is licensed separately; see THIRD_PARTY_NOTICES.md.