How capenaka/airway-ml-cfd-linux works
1. Overall shape
- This is a Python desktop application for upper-airway medical imaging workflows, not a web service.
- The repo centers on a GUI that orchestrates a pipeline from CT/CBCT input → segmentation → 3D geometry → CFD simulation → reporting.
2. Entry points and app shell
- Ortho_App/main.py is the likely startup entry point.
- Ortho_App/gui/app.py appears to build the main application window and wire together the tabs, navigation, and shared UI state.
- Top-level helper scripts blender_ortho.py and paraview_ortho.py suggest direct integration points for external visualization/processing tools.
3. Workflow is organized as a multi-tab desktop wizard
- Ortho_App/gui/tabs/tab1.py through tab4.py indicate a staged workflow UI.
- The app likely guides users through sequential phases such as data import, segmentation review, CFD setup/run, and results/report viewing.
- This tabbed structure is the main user-facing control boundary of the system.
4. Reusable UI component layer
- Ortho_App/gui/components/ contains shared widgets and dialogs: buttons, forms, navigation, progress, notebooks, info displays, and a PDF viewer.
- This layer keeps workflow tabs thin and provides common interaction patterns like progress feedback and file/dialog handling.
- The PDF viewer strongly suggests generated reports are displayed inside the app.
5. Configuration and application concerns
- Ortho_App/gui/config/ contains settings, logging configuration, and error-message definitions.
- app_logger.py in gui/utils reinforces that runtime logging is part of the app’s operational model.
- These modules define the boundary between the GUI and environment-specific behavior such as paths, logging, and user-facing errors.
6. Medical-image processing and segmentation subsystem
- Ortho_App/gui/utils/image_processing.py, segmentation.py, and get_cfd_data.py are the core data-processing utilities.
- The README states segmentation is automated using nnU-Net, so the pipeline likely consumes medical images and produces segmented airway outputs.
- basic_utils.py and tooltips.py support this workflow with general utilities and UI guidance.
7. 3D geometry and visualization subsystem
- blender_processor.py, stl_assem_image_render.py, and open3d_viewer.py indicate the app works with 3D meshes and visual preview/rendering.
- The presence of geo_files/*.stl and P5T1.nii.gz shows the repo includes sample geometry and image assets used for testing or demos.
- Blender integration suggests mesh preparation/inspection is a distinct step before CFD.
8. CFD simulation assets and case templates
- Ortho_App/data/Master_cfd_file/ is a prebuilt OpenFOAM case template containing system/, constant/, and 0/ directories.
- Files like blockMeshDict, snappyHexMeshDict, controlDict, fvSchemes, and fvSolution define the simulation setup and meshing behavior.
- Allrun, Allclean, and gnuplot* scripts show the app relies on external OpenFOAM execution and postprocessing conventions rather than implementing CFD itself.
9. Simulation output and postprocessing boundary
- The case data includes residuals and plotting scripts, implying the app collects solver outputs and converts them into readable metrics/plots.
- generate_airway_report.py is the report-generation boundary that turns CFD and segmentation results into a clinical-style output.
- pdf_viewer.py then closes the loop by letting the user inspect the generated report inside the GUI.
10. External toolchain dependencies that materially shape the architecture
- The README names Python 3.11, Blender 2.82, OpenFOAM 2306, ParaView 5.12, nnUNetv2, and a CUDA-capable NVIDIA GPU.
- This is a tool-orchestration application: the Python GUI coordinates external scientific/visualization software rather than doing all compute internally.
- ParaView and Blender are likely used for 3D inspection and postprocessing, while nnU-Net handles segmentation inference.
11. Data organization and persistence model
- The README describes per-user folders for images, segmentation artifacts, CFD outputs, and reports, even though those folders are not committed here.
- The committed Master_cfd_file and Master_cfd_file_backup look like reusable templates/backups rather than user-specific results.
- This implies a clear split between static application assets and runtime user workspace data.
12. What a diagram should emphasize
- The main flow is: GUI tabs → processing utilities → external tools/case templates → results/report viewer.
- The important boundaries are:
- UI vs. processing logic
- processing logic vs. external executables
- template case files vs. per-user runtime output
- generated CFD/segmentation artifacts vs. final report presentation
Main entry points: app.py App shell · tab2.py Tab 2 · tab3.py Tab 3 · controlDict OpenFOAM case
Components 22
GUI shell
Desktop application entry, tab workflow, and shared widgets.
- main.py · Application startup entry point.
Ortho_App/main.py - App shell · Builds the main window and wires workflow state.
Ortho_App/gui/app.py - GUI bridge · Top-level GUI launcher/helper module.
Ortho_App/GUI_ortho.py - Tab 1 · First stage of the staged desktop workflow.
Ortho_App/gui/tabs/tab1.py - Tab 2 · Middle workflow stage for review or setup.
Ortho_App/gui/tabs/tab2.py - Tab 3 · CFD-related workflow stage.
Ortho_App/gui/tabs/tab3.py - Tab 4 · Final stage for results and report viewing.
Ortho_App/gui/tabs/tab4.py - Widgets · Shared buttons, dialogs, forms, navigation, progress, notebook, info, and PDF viewer components.
Ortho_App/gui/components/__init__.py - Config · Settings, logging configuration, and user-facing error messages.
Ortho_App/gui/config/__init__.py - Logger · Application logging helper used across the GUI stack.
Ortho_App/gui/utils/app_logger.py
Processing pipeline
Image processing, segmentation, 3D geometry, and report generation.
- Image ops · Loads and prepares CT/CBCT image data for the workflow.
Ortho_App/gui/utils/image_processing.py - Segmentation · Automated airway segmentation and mask handling.
Ortho_App/gui/utils/segmentation.py - CFD data · Extracts and packages CFD-relevant inputs and outputs.
Ortho_App/gui/utils/get_cfd_data.py - Blender proc · Prepares or inspects mesh geometry through Blender integration.
Ortho_App/gui/utils/blender_processor.py - 3D render · STL assembly and image rendering for geometry review.
Ortho_App/gui/utils/stl_assem_image_render.py - Open3D view · Interactive 3D geometry viewer.
Ortho_App/gui/utils/open3d_viewer.py - Report · Generates the airway report from processing and CFD results.
Ortho_App/gui/utils/generate_airway_report.py
CFD template
Reusable OpenFOAM case assets and solver/postprocessing scripts.
- OpenFOAM case · Reusable CFD case template with system, constant, and initial-condition files.
Ortho_App/data/Master_cfd_file/system/controlDict - Case backup · Backup copy of the OpenFOAM case template.
Ortho_App/data/Master_cfd_file_backup/system/controlDict - Run scripts · Allrun, Allclean, and gnuplot scripts for OpenFOAM execution and plotting.
Ortho_App/data/Master_cfd_file/Allrun
Other components
- blender_ortho.py · Standalone Blender-facing integration script.
Ortho_App/blender_ortho.py - paraview_ortho.py · Standalone ParaView-facing integration script.
Ortho_App/paraview_ortho.py
Connections 27
- main.py → App shell: starts · Main entry launches the application shell.
- GUI bridge → App shell: launches · Alternative launcher routes into the same GUI shell.
- App shell → Tab 1: hosts · App shell instantiates the staged workflow tabs.
- App shell → Tab 2: hosts · App shell instantiates the staged workflow tabs.
- App shell → Tab 3: hosts · App shell instantiates the staged workflow tabs.
- App shell → Tab 4: hosts · App shell instantiates the staged workflow tabs.
- App shell → Widgets: uses · Tabs and shell share reusable widgets and dialogs.
- App shell → Config: loads · App shell uses runtime settings and logging configuration.
- Config → Logger: configures · Logging setup feeds the shared logger.
- Tab 1 → Image ops: imports · Early workflow stage handles image input and preparation.
- Tab 1 → Segmentation: starts · Segmentation is triggered from the workflow.
- Tab 2 → Blender proc: prepares · Geometry review and mesh preparation step.
- Tab 2 → Open3D view: reviews · Interactive geometry inspection.
- Tab 2 → 3D render: renders · Workflow generates preview imagery for geometry review.
- Tab 3 → CFD data: packages · CFD stage collects simulation inputs and outputs.
- Tab 3 → OpenFOAM case: writes to · Workflow populates the OpenFOAM case template.
- Tab 3 → Run scripts: executes · Simulation run and plotting are delegated to case scripts.
- Tab 4 → Report: generates · Final stage produces the clinical-style report.
- Tab 4 → Widgets: displays · PDF viewer and related widgets present results in-app.
- Image ops → Segmentation: feeds · Prepared images are consumed by segmentation.
- Segmentation → CFD data: outputs · Segmentation results become CFD-relevant data.
- Blender proc → blender_ortho.py: bridges · Blender integration is exposed through a dedicated script.
- Open3D view → paraview_ortho.py: bridges · ParaView integration is exposed through a dedicated script.
- OpenFOAM case → Case backup: mirrors · Backup preserves a parallel copy of the case template.
- OpenFOAM case → Run scripts: contains · Template bundles solver and plotting scripts.
- Report → Widgets: renders · Generated PDF report is shown through shared UI components.
- OpenFOAM case → Report: supplies metrics · CFD outputs inform the report generation boundary.