How cdttk/biv-volumetric-meshing works
This repository builds finite-element biventricular heart models from UK Biobank CMR, with src/run.py dispatching selectable pipeline stages. The principal workflow is NIfTI images → segmentation → contour extraction → fitted surface meshes → volumetric meshes, followed by optional universal ventricular coordinates (UVC) and fiber generation. Surface fitting uses contour datasets and a biventricular model; the repository also includes model-based mass and volume measurement. The README documents the stage sequence, while sampled source confirms dispatch and portions of segmentation, fitting, and volumetric processing; unsampled stage internals are represented only at their documented boundaries.
Main entry points: run.py Stage runner · perform_fit.py Surface fitting · predict_UKBB.py nnUNet prediction · main_testvmesh.py Volumetric meshing
Components 16
Pipeline dispatch
- Stage runner
src/run.py
Image segmentation
- nnUNet prediction
src/segmentation/predict_UKBB.py
Contour and surface
- Contour extraction
src/surface/contour2gp_QS.py - Surface fitting
src/surface/perform_fit.py - Contour dataset
src/surface/BiVFitting/GPDataSet.py - Biventricular model
src/surface/BiVFitting/BiventricularModel.py - Mesh conversion
src/surface/mesh_txt_to_vtk.py
Volumetric modeling
- Volumetric meshing
src/volumetric/main_testvmesh.py - Mesh generation
src/volumetric/v_mesh_generation.py - UVC and fibers
src/volumetric/compute_UVC_fiber.py
Model analysis
- Mass and volume
src/surface/mass_volume/Mass_volume.py - Mesh utilities
src/surface/mass_volume/mesh.py
Other components
- Pipeline user
- CMR NIfTI inputs
- nnUNet models
- openCARP tools
Connections 20
- Pipeline user → Stage runner: selects stages
- CMR NIfTI inputs → nnUNet prediction: provides images
- Stage runner → nnUNet prediction: dispatches
- nnUNet prediction → nnUNet models: runs prediction
- Stage runner → Contour extraction: dispatches
- nnUNet prediction → Contour extraction: provides segmentations
- Stage runner → Surface fitting: dispatches
- Contour extraction → Surface fitting: provides contours
- Surface fitting → Contour dataset: constructs dataset
- Surface fitting → Biventricular model: fits model
- Stage runner → Mesh conversion: dispatches
- Stage runner → Volumetric meshing: dispatches
- Mesh conversion → Volumetric meshing: provides surface mesh
- Volumetric meshing → Mesh generation: generates mesh
- Mesh generation → openCARP tools: invokes tools
- Stage runner → UVC and fibers: dispatches
- UVC and fibers → openCARP tools: invokes tools
- Volumetric meshing → UVC and fibers: provides volumetric mesh
- Surface fitting → Mass and volume: provides fitted model
- Mass and volume → Mesh utilities: uses mesh operations