How raidionics/aeropath works
Project type and purpose
• This is a Python-based ML web demo (“AeroPath”) for automatic airway segmentation.
• It bundles a Gradio frontend (demo/app.py) with a Raidionics deep-learning backend, containerized via Docker, and can fetch the AeroPath dataset from the Hugging Face Hub or Zenodo.
File structure
• Top-level:
• Dockerfile, .dockerignore → container build
• README.md, LICENSE.md → project description, license
• setup.cfg → code formatting/linters
• .github/workflows → CI/CD pipelines (deploy, filesize check, linting)
• demo/:
• app.py → Gradio app entry point
• requirements.txt → Python dependencies (Gradio, Raidionics, nibabel, etc.)
• src/
– gui.py → UI layout and event handlers
– inference.py → calls segmentation model, orchestrates input/output
– convert.py → data format conversions (e.g., NIfTI to arrays)
– css_style.py → custom CSS for UI
– utils.py → shared helper functions
– logger.py → logging abstraction
• notebooks/: example notebooks for dataset loading and exploration
• shell/: lint/format scripts
README for additional insights
• Confirms use of Gradio for frontend, Raidionics for segmentation, Hugging Face Datasets for data access.
• Provides Docker and local-Python launch commands.
• Mentions CI/CD status badges linking to GitHub Actions.
a. Main components
• User (Web Browser)
• Gradio Web UI (demo/app.py + gui.py + css_style.py)
• Application Logic Layer (demo/src/inference.py, utils.py, convert.py)
• Raidionics Backend (external Python library implementing segmentation)
• Data Source (Hugging Face Hub / Zenodo)
• Logging Module (demo/src/logger.py)
• Containerization & Env (Docker container or local venv)
• CI/CD (GitHub Actions workflows)
b. Relationships & data flow
1. User submits a CT scan via the Gradio interface
2. UI layer passes the input to inference.py
3. inference.py invokes:
– convert.py to transform file formats if needed
– Raidionics library to run the segmentation model
– utils.py for post-processing (e.g., thresholding)
4. Segmentation results return to UI for display
5. logger.py captures events/errors throughout steps
6. If a new dataset is requested, the app fetches it from the Hugging Face Hub
7. Entire app runs inside a Docker container (or Python venv)
8. CI/CD pipelines build, test, lint, and deploy the container to Hugging Face Spaces
c. Architectural patterns & design principles
• Modular monolith: clear separation of UI, business logic, and utilities
• MVC-like: gui.py = View, inference.py = Controller, convert/utils = Model
• Containerization for environment consistency
• CI/CD for automated testing, linting, size checks, and deployment
d. Key technologies/frameworks
• Python 3.x
• Gradio (frontend)
• Raidionics (segmentation backend)
• nibabel or similar (NIfTI handling)
• Hugging Face Datasets (data loading)
• Docker
• GitHub Actions (CI/CD)