# id-b3/airflow-imalife architecture

> Architecture diagram of the GitHub repository id-b3/airflow-imalife, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/id-b3/airflow-imalife
- Repository: https://github.com/id-b3/airflow-imalife

## Overview

AirFlow-ImaLife processes a DICOM CT scan into airway segmentations, airway-wall meshes and bronchial measurements; scans may be submitted singly or in parallel. The README documents the runtime stages, while the sampled source shows selected launch, summary and phantom-training implementations. The graph also preserves the substantial phantom-optimization subsystem named in the source index. Most main-pipeline links reflect README documentation rather than inspected stage code; unsampled implementation details are not inferred.

Main entry points: [`scripts/run_machine.sh`](https://github.com/id-b3/airflow-imalife/blob/main/scripts/run_machine.sh) (Pipeline entrypoint), [`phantom_trainer/phantoptimize/phantomtrainer.py`](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/phantomtrainer.py) (Phantom trainer), [`scripts/launch_scripts/airflowmp.py`](https://github.com/id-b3/airflow-imalife/blob/main/scripts/launch_scripts/airflowmp.py) (Batch launcher), [`scripts/processing_scripts/airway_summary.py`](https://github.com/id-b3/airflow-imalife/blob/main/scripts/processing_scripts/airway_summary.py) (Bronchial summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Scan intake"]
  node_dicom["DICOM series"]
  node_batch["Batch launcher<br/>[airflowmp.py]"]
  node_runtime["Pipeline entrypoint<br/>[run_machine.sh]"]
  node_volume["Volume creation"]
end

subgraph group_segmentation["Airway segmentation"]
  node_coarse["Coarse airway prep"]
  node_unet["3D U-Net inference"]
end

subgraph group_measurement["Wall measurement"]
  node_opfront["Wall separation"]
  node_postprocess["Mesh and thumbnail"]
  node_summary["Bronchial summary<br/>[airway_summary.py]"]
  node_results["Scan results"]
  node_analysis["Reproducibility analysis"]
end

subgraph group_phantom["Phantom optimization"]
  node_optimizer["Parameter optimizer"]
  node_trainer["Phantom trainer<br/>[phantomtrainer.py]"]
  node_bounds["Region bounds"]
  node_region_split["Region splitting"]
  node_branch_merge["Branch merge"]
  node_measure_merge["Measure merge"]
  node_grid_analysis["Grid analysis"]
end

node_scan_user(("Scan operator"))

node_scan_user -->|"provides"| node_dicom
node_scan_user -->|"runs scan"| node_runtime
node_scan_user -->|"submits scans"| node_batch
node_batch -->|"launches container"| node_runtime
node_dicom -->|"mounts input"| node_runtime
node_runtime -->|"creates volume"| node_volume
node_runtime -->|"runs prep"| node_coarse
node_runtime -->|"runs inference"| node_unet
node_runtime -->|"runs separation"| node_opfront
node_runtime -->|"runs postprocess"| node_postprocess
node_runtime -->|"runs measurements"| node_summary
node_runtime -->|"writes results"| node_results
node_summary -->|"writes summary"| node_results
node_results -.->|"analyzes results"| node_analysis
node_optimizer -->|"optimizes runs"| node_trainer
node_trainer -->|"computes bounds"| node_bounds
node_trainer -->|"launches tool"| node_opfront
node_bounds -.->|"bounds regions"| node_region_split
node_branch_merge -.->|"merges outputs"| node_measure_merge
node_measure_merge -.->|"supplies measures"| node_grid_analysis

click node_batch "https://github.com/id-b3/airflow-imalife/blob/main/scripts/launch_scripts/airflowmp.py"
click node_runtime "https://github.com/id-b3/airflow-imalife/blob/main/scripts/run_machine.sh"
click node_volume "https://github.com/id-b3/airflow-imalife/tree/main/airflow_legacy"
click node_coarse "https://github.com/id-b3/airflow-imalife/tree/main/scripts/processing_scripts"
click node_unet "https://github.com/id-b3/airflow-imalife/tree/main/bronchinet"
click node_opfront "https://github.com/id-b3/airflow-imalife/tree/main/opfront"
click node_postprocess "https://github.com/id-b3/airflow-imalife/tree/main/scripts/processing_scripts"
click node_summary "https://github.com/id-b3/airflow-imalife/blob/main/scripts/processing_scripts/airway_summary.py"
click node_analysis "https://github.com/id-b3/airflow-imalife/blob/main/scripts/reproducibility_analysis_scripts/bronchial_parameters_per_generation.py"
click node_optimizer "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/optimise_parameters.py"
click node_trainer "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/phantomtrainer.py"
click node_bounds "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/calc_boundbox_regions.py"
click node_region_split "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/split_segmentation_regions.py"
click node_branch_merge "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/merge_branches_regions.py"
click node_measure_merge "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/measure/merge_measures_regions.py"
click node_grid_analysis "https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/measure/analyse_measures_gridsearch.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dicom,node_batch,node_runtime,node_volume toneBlue
class node_coarse,node_unet toneAmber
class node_opfront,node_postprocess,node_summary,node_results,node_analysis toneMint
class node_optimizer,node_trainer,node_bounds,node_region_split,node_branch_merge,node_measure_merge,node_grid_analysis toneRose
class node_scan_user toneIndigo
```

## Components

### Scan intake

- **DICOM series**
- [Batch launcher](https://github.com/id-b3/airflow-imalife/blob/main/scripts/launch_scripts/airflowmp.py): `scripts/launch_scripts/airflowmp.py`
- [Pipeline entrypoint](https://github.com/id-b3/airflow-imalife/blob/main/scripts/run_machine.sh): `scripts/run_machine.sh`
- [Volume creation](https://github.com/id-b3/airflow-imalife/tree/main/airflow_legacy): `airflow_legacy`

### Airway segmentation

- [Coarse airway prep](https://github.com/id-b3/airflow-imalife/tree/main/scripts/processing_scripts): `scripts/processing_scripts`
- [3D U-Net inference](https://github.com/id-b3/airflow-imalife/tree/main/bronchinet): `bronchinet`

### Wall measurement

- [Wall separation](https://github.com/id-b3/airflow-imalife/tree/main/opfront): `opfront`
- [Mesh and thumbnail](https://github.com/id-b3/airflow-imalife/tree/main/scripts/processing_scripts): `scripts/processing_scripts`
- [Bronchial summary](https://github.com/id-b3/airflow-imalife/blob/main/scripts/processing_scripts/airway_summary.py): `scripts/processing_scripts/airway_summary.py`
- **Scan results**
- [Reproducibility analysis](https://github.com/id-b3/airflow-imalife/blob/main/scripts/reproducibility_analysis_scripts/bronchial_parameters_per_generation.py): `scripts/reproducibility_analysis_scripts/bronchial_parameters_per_generation.py`

### Phantom optimization

- [Parameter optimizer](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/optimise_parameters.py): `phantom_trainer/optimise_parameters.py`
- [Phantom trainer](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/phantomtrainer.py): `phantom_trainer/phantoptimize/phantomtrainer.py`
- [Region bounds](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/calc_boundbox_regions.py): `phantom_trainer/phantoptimize/split/calc_boundbox_regions.py`
- [Region splitting](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/split_segmentation_regions.py): `phantom_trainer/phantoptimize/split/split_segmentation_regions.py`
- [Branch merge](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/split/merge_branches_regions.py): `phantom_trainer/phantoptimize/split/merge_branches_regions.py`
- [Measure merge](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/measure/merge_measures_regions.py): `phantom_trainer/phantoptimize/measure/merge_measures_regions.py`
- [Grid analysis](https://github.com/id-b3/airflow-imalife/blob/main/phantom_trainer/phantoptimize/measure/analyse_measures_gridsearch.py): `phantom_trainer/phantoptimize/measure/analyse_measures_gridsearch.py`

### Other components

- **Scan operator**

## Connections

- Scan operator → DICOM series: provides (evidence: `README.md`)
- Scan operator → Pipeline entrypoint: runs scan (evidence: `README.md`)
- Scan operator → Batch launcher: submits scans (evidence: `README.md`)
- Batch launcher → Pipeline entrypoint: launches container (evidence: `README.md`)
- DICOM series → Pipeline entrypoint: mounts input (evidence: `README.md`)
- Pipeline entrypoint → Volume creation: creates volume (evidence: `README.md`)
- Pipeline entrypoint → Coarse airway prep: runs prep (evidence: `README.md`)
- Pipeline entrypoint → 3D U-Net inference: runs inference (evidence: `README.md`)
- Pipeline entrypoint → Wall separation: runs separation (evidence: `README.md`)
- Pipeline entrypoint → Mesh and thumbnail: runs postprocess (evidence: `README.md`)
- Pipeline entrypoint → Bronchial summary: runs measurements (evidence: `README.md`)
- Pipeline entrypoint → Scan results: writes results (evidence: `README.md`)
- Bronchial summary → Scan results: writes summary (evidence: `scripts/processing_scripts/airway_summary.py`)
- Scan results → Reproducibility analysis: analyzes results
- Parameter optimizer → Phantom trainer: optimizes runs (evidence: `phantom_trainer/optimise_parameters.py`)
- Phantom trainer → Region bounds: computes bounds (evidence: `phantom_trainer/phantoptimize/phantomtrainer.py`)
- Phantom trainer → Wall separation: launches tool (evidence: `phantom_trainer/phantoptimize/phantomtrainer.py`)
- Region bounds → Region splitting: bounds regions
- Branch merge → Measure merge: merges outputs
- Measure merge → Grid analysis: supplies measures
