Skip to content

About

Virtual Surgical Planning with Biomechanical Simulation of Soft Tissue Reconstruction Surgery

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

VSP-BioSim

Patient-Specific Virtual Surgical Planning via Biomechanical Simulations

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.

What it does (key capabilities)

  • 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.

Repository layout

  • main.py — end-to-end runner; executes a list of simulations (120 lines) defined in configs/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.).

Quick start (Windows, cmd)

  1. Create environment and install dependencies
uv venv
uv sync
  1. 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_PATH near the top of main.py.
  1. Run the main.py
uv run python main.py

Optional: 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.

Inputs and outputs

Each case folder (e.g., inputs_A) must contain these OBJ files:

  • native_tongue.obj — baseline anatomy
  • resection.obj — planned resection volume
  • tongue_resected.obj — tongue after boolean resection (native_tongue minus resection)
  • surf3D.obj — resection boundary surface used by hiFEM (outher surface of the resection.obj)
  • mandible.obj — rigid reference for boundary conditions
  • fixed_nodes.obj — region to fix at anatomical attachments
  • tongue_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, and Simul_metrics.json (runtime and mesh stats).

Configuration (factorial sweeps)

Parameters are defined per row in configs/parameter_grid.csv:

  • experiment_id — unique name; becomes the output folder suffix
  • inputs_folder — one of inputs_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_level in {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.

How it works (pipeline at a glance)

  1. hiFEM generates a biomechanically optimized planar flap template with 3D↔2D node mapping.
  2. Volume flattening builds a 3D free flap model congruent to the template; multilayer flap (skin+fat) is formed.
  3. fTetWild builds tet meshes; meshes are elevated to tet10 and partitioned into skin/fat.
  4. Suturing is simulated by distributed springs around sampled edge points; sticky/penalty contacts resolve interfaces.
  5. A brief viscoelastic relaxation yields Day‑0; adipose atrophy runs to an estimated ~1‑year state.
  6. Metrics are computed for anatomy restoration and native-tissue strain.

Requirements

  • 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: the FloatTetwild_bin.exe CLI gives necessary control for congruent multilayer meshing)
  • Python deps: see requirements.txt (plus confmap from GitHub). PyVista with trame enables exported HTML views.

Cite

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.

License

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.

About

Virtual Surgical Planning with Biomechanical Simulation of Soft Tissue Reconstruction Surgery

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages