From 77adc2b3af46fce73abca89912867db40a74fcc2 Mon Sep 17 00:00:00 2001 From: Furen Xiao Date: Sat, 26 Sep 2026 11:04:20 +0800 Subject: [PATCH] feat(monai): add MONAI pipeline C implementation Introduce the third segmentation pipeline using MONAI (1.6.x) to allow direct comparison with Pipelines A and B. This includes the implementation of the iterative pseudo-labeling workflow, training scripts, and inference protocols. - Add `scripts_monai/` directory containing the MONAI pipeline scripts. - Update documentation in `README.md` and `AGENTS.md` to include MONAI package requirements and pipeline details. - Configure `.gitignore` to exclude MONAI-specific run directories. - Update data directory descriptions to include MONAI pseudo-labels. --- .gitignore | 1 + AGENTS.md | 6 +- README.md | 80 ++++++++- scripts_monai/01_monai_build_rows.py | 64 ++++++++ scripts_monai/02_monai_train.py | 156 ++++++++++++++++++ scripts_monai/03_monai_pseudo_label.py | 169 +++++++++++++++++++ scripts_monai/04_monai_eval_test.py | 103 ++++++++++++ scripts_monai/05_monai_run_iterative.py | 180 ++++++++++++++++++++ scripts_monai/monai_common.py | 208 ++++++++++++++++++++++++ 9 files changed, 961 insertions(+), 6 deletions(-) create mode 100644 scripts_monai/01_monai_build_rows.py create mode 100644 scripts_monai/02_monai_train.py create mode 100644 scripts_monai/03_monai_pseudo_label.py create mode 100644 scripts_monai/04_monai_eval_test.py create mode 100644 scripts_monai/05_monai_run_iterative.py create mode 100644 scripts_monai/monai_common.py diff --git a/.gitignore b/.gitignore index c0ccec6..78e1108 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ results/ logs/ nnu/ runs_nnu/ +runs_monai/ __pycache__/ diff --git a/AGENTS.md b/AGENTS.md index 747b13f..565bd7e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,7 +10,7 @@ Activate with: source /opt/conda/etc/profile.d/conda.sh && conda activate longitudinal ``` -Key packages: torch 2.14 (+cu126), torchvision, numpy, scipy, pandas, scikit-learn, scikit-image, matplotlib, nibabel, SimpleITK. +Key packages: torch 2.14 (+cu126), torchvision, monai 1.6 (pip, Pipeline C), numpy, scipy, pandas, scikit-learn, scikit-image, matplotlib, nibabel, SimpleITK. ## Project @@ -19,5 +19,5 @@ Longitudinal (repeated-measures) analysis of medical imaging data. Repo is at an ## Conventions - All Python commands must run inside the `longitudinal` conda environment. -- GPU is available (CUDA 12.6); use `torch.device('cuda')` when appropriate. -- No lint/test tooling is configured yet; run scripts directly with `python