tpt-medical

Rust

Fully open-source, pure-Rust computational biomechanics and medical device simulation engine, compiling to WASM for zero-cloud, browser-based surgical planning.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust95.0%HTML2.7%Shell1.3%JavaScript1.0%PowerShell0.0%
README

tpt-medical

A fully open-source, pure-Rust computational biomechanics and medical device simulation engine, compiling to WebAssembly for zero-cloud, browser-based surgical planning.

Organization: TPT Solutions (tpt-solutions) · License: MIT OR Apache-2.0 · Crate prefix: tpt-med-*


Why

Medical device design and surgical planning require FDA-mandated FEA and fluid dynamics, but legacy tools are proprietary black boxes (Abaqus, Ansys), carry academic license traps (FEBio, OpenSim), or demand cloud upload of patient DICOM data (HIPAA/GDPR risk). tpt-medical eliminates all three:

  • No license barrier — permissive dual licensing, no copyleft contamination.
  • Zero-cloud patient privacy — compiles to WASM; imaging and simulation run entirely in the browser or on a local hospital workstation.
  • Reproducible FDA submissions — open, auditable mathematics with 21 CFR Part 11 audit trails and ASME V&V 40 credibility tooling.

Crates

Every crate is documented individually: a comprehensive README (overview, features, conventions, runnable usage, API table, verification evidence, dependencies, known limitations) and a Keep a Changelog-format CHANGELOG recording what changes for its consumers. Crates version and release independently, so those two files are the per-crate source of truth.

CrateDescriptionDocsStatus
tpt-med-corePatient models, anatomical coordinate systems, HIPAA-safe audit traitsREADME · CHANGELOG🚧 Alpha
tpt-med-unitsType-safe unit system (mm, MPa, N, g/cm³)README · CHANGELOG🚧 Alpha
tpt-med-geometryGeometry primitives, anatomical transformsREADME · CHANGELOG🚧 Alpha
tpt-med-wasmWASM bindings for the in-browser stackREADME · CHANGELOG🚧 Alpha
tpt-med-dicomDICOM parsing & Hounsfield Unit mappingREADME · CHANGELOG🚧 Alpha
tpt-med-niftiNIfTI-1 volume parsing (research-space imaging)README · CHANGELOG🚧 Alpha
tpt-med-meshingSegmentation masks & voxel-to-hex meshingREADME · CHANGELOG🚧 Alpha
tpt-med-biomechanicsVoxel hexahedral FEM solver coreREADME · CHANGELOG🚧 Alpha
tpt-med-tissueHyperelastic tissue models (Neo-Hookean, Mooney-Rivlin, Ogden, HGO)README · CHANGELOG🚧 Alpha
tpt-med-boneBone mechanics & Wolff's-Law remodelingREADME · CHANGELOG🚧 Alpha
tpt-med-viscoelasticProny-series viscoelasticityREADME · CHANGELOG🚧 Alpha
tpt-med-cartilageBiphasic/poroelastic cartilage modelsREADME · CHANGELOG🚧 Alpha
tpt-med-hemodynamicsNavier–Stokes CFD, WSS & OSIREADME · CHANGELOG🚧 Alpha
tpt-med-cardiovascularWindkessel models, FFRREADME · CHANGELOG🚧 Alpha
tpt-med-stentsNitinol superelasticity, stent deploymentREADME · CHANGELOG🚧 Alpha
tpt-med-orthopedicsMicromotion & stress-shielding analysisREADME · CHANGELOG🚧 Alpha
tpt-med-wearArchard / Cross-Land wear lawsREADME · CHANGELOG🚧 Alpha
tpt-med-surgical-planningOsteotomy cuts, virtual surgeryREADME · CHANGELOG🚧 Alpha
tpt-med-implant-sizingAutomated implant sizing from anatomyREADME · CHANGELOG🚧 Alpha
tpt-med-auditCryptographic audit signing & verificationREADME · CHANGELOG🚧 Alpha
tpt-med-fda21 CFR Part 11 audit trailsREADME · CHANGELOG🚧 Alpha
tpt-med-vv40ASME V&V 40 credibility assessmentREADME · CHANGELOG🚧 Alpha
tpt-med-examplesRunnable end-to-end example binariesREADME · CHANGELOG🚧 Alpha
tpt-med-benchesWorkspace benchmark suiteREADME · CHANGELOG🚧 Alpha

Quick Start

Build the workspace and run the Phase 1 milestone CLI, which converts a DICOM CT series into a patient-specific bone mesh CSV:

cargo run -p tpt-med-examples --bin dicom-to-mesh -- \
    test-data/dicom/synthetic_ct --output femur_mesh.csv --threshold 200

Use the solver stack in Rust:

use std::path::Path;

use tpt_med_dicom::DicomSeries;
use tpt_med_meshing::{MedicalMesher, SegmentationMask};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let series = DicomSeries::load_from_dir(Path::new("test-data/dicom/synthetic_ct"))?;
    let mask = SegmentationMask::threshold_hu(&series, 200.0);
    let mesh = MedicalMesher::default().voxels_to_hex_mesh(&mask)?;
    mesh.write_csv(Path::new("bone_mesh.csv"))?;
    Ok(())
}

Zero-Cloud Patient Privacy

All simulations run entirely locally; the WASM build (tpt-med-wasm) runs the full imaging-to-simulation pipeline inside the browser. Patient DICOM scans never leave the hospital network. The repository's test data is synthetic only — never commit real patient data.

Browser apps under web/: the surgical planning viewer, the white-label <tpt-stent-simulator> web component, and the end-to-end CT → mesh → FEM → stent in-browser demo (scripts/build-web.sh builds the engine).

Browser Demos

Build the engine glue once, then serve the repository root:

./scripts/build-web.sh          # or scripts\build-web.ps1 on Windows
python -m http.server 8080
  • Viewer — http://localhost:8080/web/viewer/: upload a DICOM series (or the synthetic CT demo), mesh it, solve a stance load, and inspect von Mises stress in WebGL2; plus in-browser stent deployment.
  • White-label stent simulator — http://localhost:8080/web/stent-simulator/: the embeddable <tpt-stent-simulator> custom element with live branding controls (see web/stent-simulator/README.md).

Try it without installing anything: a live build of the viewer is published to GitHub Pages on every merge to master that touches the engine or the web assets, against the committed synthetic CT data. See the repository's Demo workflow for the published URL, or run it locally with the two commands above.

Verification & Validation

Following ASME V&V 40, every solver ships with verification tests against analytical solutions (uniaxial tension, Euler–Bernoulli beam deflection, Poiseuille flow, Prony relaxation) and curated golden reference datasets under test-data/golden/. Standards automation targets ASTM F2028 / F2079 / F2394 and ISO 7206 / 14879.

Substrate

Built on the TPT engineering stack (pinned in the root Cargo.toml): tpt-math (fixed-size linalg, optimization, probability, signal filtering), tpt-engineering (biocompatible material libraries), tpt-science (bio-fluid dynamics), and tpt-fem (nonlinear FEM, contact). Medical crates are deliberately dependency-light (std only) to keep the WASM footprint small; substrate integration points are documented per crate and in the RFCs.

Contributing

Bug reports, feature requests, RFC proposals, and documentation corrections are all welcome, and all arrive as GitHub issues — this project does not accept external pull requests. See CONTRIBUTING.md for the process and the RFC process for significant design changes. New constitutive models, solver algorithms, and regulatory features require an accepted RFC, and numerical behaviour is treated as API. Everything is DCO-signed and CLA-free.

License

Licensed under either of

at your option.

Regulatory Disclaimer

This software is for research and development purposes only. It is not cleared or approved by the FDA or any other regulatory body for clinical diagnostic or treatment use. Regulatory submissions require validation under ASME V&V 40 and applicable standards.