PulmoSim converts a chest CT scan (DICOM series or NIfTI) into a 3D STL mesh of the lungs, optionally segments the airway, and visualizes the result in a lightweight frontend. A placeholder physics overlay previews potential deposition patterns for different particle sizes.
pip install -r requirements.txt
python server.py # starts FastAPI at http://localhost:8000API:
POST /processform-data:files(one or many),iso,lung_hu_low,lung_hu_high,decimate, optionalairway_enabled,airway_seed_z,airway_seed_y,airway_seed_x.- Returns JSON with
lungs_urland optionalairway_url(served under/files/{job_id}/...).
cd frontend
npm install
npm run dev # http://localhost:5173Create frontend/.env (optional):
VITE_API_BASE=http://localhost:8000python3 ct_to_mesh.py \
--input /path/to/dicom_folder_or_nii \
--out lungs.stl \
--iso 1.0 \
--lung-hu-low -1000 \
--lung-hu-high -400 \
--decimate 0.5 \
[--airway-out airway.stl --airway-seed z y x]- DICOM uploads: The app accepts a ZIP with a DICOM series or multiple
.dcmfiles. It will attempt to read the first series found. - Large scans: Processing may take a minute; consider increasing
--iso(e.g., 1.5–2.0 mm) for faster turnaround. - Physics overlay: Currently a placeholder coloring. Replace with your physics model when available.
This repo previously included a Streamlit prototype (app.py). The new stack replaces it with React + FastAPI. You can remove app.py if not needed.