VibecoderMcSwaggins commited on
Commit
211e2f6
·
1 Parent(s): aef1f5a

docs: document SEALS model selection and scientific rationale

Browse files

- Explain why we use `--fast True` (runs SEALS, the ISLES'22 winner)
- Document that SEALS only needs DWI+ADC (perfect match for MR-Lite)
- Add model comparison table (SEALS vs NVAUTO vs SWAN)
- Clarify that FLAIR is only needed for full ensemble mode
- Document external validation rationale (ISLES22 training → ISLES24 testing)
- Update all specs with consistent SEALS/fast mode comments

Files updated:
- 00-context.md: Full SEALS explanation and scientific validity
- 01-phase-0-repo-bootstrap.md: Config comment
- 03-phase-2-deepisles-docker.md: CLI reference section
- 04-phase-3-pipeline.md: Function docstring
- 05-phase-4-gradio-ui.md: UI checkbox label/info
- 06-phase-5-polish.md: Config comment

docs/specs/00-context.md CHANGED
@@ -95,9 +95,37 @@ data/scratch/isles24_extracted/
95
  - **Paper**: Nature Communications 2025 - "DeepISLES: A clinically validated ischemic stroke segmentation model"
96
  - **GitHub**: [ezequieldlrosa/DeepIsles](https://github.com/ezequieldlrosa/DeepIsles)
97
  - **Docker**: `isleschallenge/deepisles`
98
- - **Inputs**: DWI + ADC (required), FLAIR (optional)
99
  - **Output**: 3D binary lesion mask (NIfTI)
100
- - **Mode**: We use `fast=True` (single model) not the full 3-model ensemble
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  ### 3. visualization: NiiVue
103
 
 
95
  - **Paper**: Nature Communications 2025 - "DeepISLES: A clinically validated ischemic stroke segmentation model"
96
  - **GitHub**: [ezequieldlrosa/DeepIsles](https://github.com/ezequieldlrosa/DeepIsles)
97
  - **Docker**: `isleschallenge/deepisles`
98
+ - **Inputs**: DWI + ADC (required), FLAIR (required for ensemble, optional for fast mode)
99
  - **Output**: 3D binary lesion mask (NIfTI)
100
+ - **Mode**: `fast=True` runs **SEALS only** (the ISLES'22 challenge winner)
101
+
102
+ #### Why we use `fast=True` (SEALS-only mode)
103
+
104
+ DeepISLES is an ensemble of 3 models from the ISLES'22 challenge:
105
+
106
+ | Model | Based On | Inputs Required | Notes |
107
+ |-------|----------|-----------------|-------|
108
+ | **SEALS** | nnUNet | DWI + ADC | 🏆 **ISLES'22 Winner** - runs in `--fast` mode |
109
+ | NVAUTO | MONAI Auto3dseg | DWI + ADC + FLAIR | Requires FLAIR |
110
+ | SWAN | FACTORIZER | DWI + ADC + FLAIR | Requires FLAIR |
111
+
112
+ **Key insight**: ISLES24-MR-Lite contains only DWI + ADC (no FLAIR). Therefore:
113
+ - `--fast True` → Runs SEALS only → **Perfect match** for our dataset
114
+ - `--fast False` → Would try to run all 3 models → NVAUTO/SWAN would fail without FLAIR
115
+
116
+ This is **not a downgrade**. SEALS won the ISLES'22 challenge and is state-of-the-art for stroke lesion segmentation using DWI+ADC alone.
117
+
118
+ #### Scientific validity: External validation with zero data leakage
119
+
120
+ | Dataset | Year | Used For |
121
+ |---------|------|----------|
122
+ | **ISLES 2022** | 2022 | SEALS training data (250 cases) |
123
+ | **ISLES 2024** | 2024 | Our test data (149 cases from MR-Lite) |
124
+
125
+ - Different patient cohorts (2 years apart, different hospitals)
126
+ - SEALS has **never seen** ISLES24 patients
127
+ - We have ground truth masks → can validate predictions
128
+ - This constitutes a legitimate **external validation study**
129
 
130
  ### 3. visualization: NiiVue
131
 
docs/specs/01-phase-0-repo-bootstrap.md CHANGED
@@ -233,7 +233,7 @@ class Settings(BaseSettings):
233
 
234
  # DeepISLES
235
  deepisles_docker_image: str = "isleschallenge/deepisles"
236
- deepisles_fast_mode: bool = True
237
 
238
  # Paths
239
  temp_dir: str | None = None
 
233
 
234
  # DeepISLES
235
  deepisles_docker_image: str = "isleschallenge/deepisles"
236
+ deepisles_fast_mode: bool = True # SEALS-only (ISLES'22 winner, no FLAIR needed)
237
 
238
  # Paths
239
  temp_dir: str | None = None
docs/specs/03-phase-2-deepisles-docker.md CHANGED
@@ -55,11 +55,28 @@ docker run --rm \
55
  **Expected input files:**
56
  - `dwi.nii.gz` (required) - Diffusion-weighted imaging
57
  - `adc.nii.gz` (required) - Apparent diffusion coefficient
58
- - `flair.nii.gz` (optional) - FLAIR sequence
59
 
60
  **Output:**
61
  - `results/` directory containing the lesion mask
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ## interfaces and types
64
 
65
  ### `inference/docker.py`
 
55
  **Expected input files:**
56
  - `dwi.nii.gz` (required) - Diffusion-weighted imaging
57
  - `adc.nii.gz` (required) - Apparent diffusion coefficient
58
+ - `flair.nii.gz` (optional) - Required for full ensemble, not needed for fast mode
59
 
60
  **Output:**
61
  - `results/` directory containing the lesion mask
62
 
63
+ ### Why `--fast True` (SEALS-only mode)
64
+
65
+ DeepISLES contains 3 models from the ISLES'22 challenge:
66
+
67
+ | Model | Inputs | Notes |
68
+ |-------|--------|-------|
69
+ | **SEALS** (nnUNet) | DWI + ADC | 🏆 ISLES'22 Winner - runs with `--fast True` |
70
+ | NVAUTO (MONAI) | DWI + ADC + FLAIR | Requires FLAIR |
71
+ | SWAN (FACTORIZER) | DWI + ADC + FLAIR | Requires FLAIR |
72
+
73
+ **We default to `fast=True` because:**
74
+ 1. ISLES24-MR-Lite only has DWI + ADC (no FLAIR)
75
+ 2. SEALS alone is the challenge-winning algorithm
76
+ 3. Running the full ensemble without FLAIR would fail for 2/3 models
77
+
78
+ This is not a compromise—SEALS is state-of-the-art for DWI+ADC stroke segmentation.
79
+
80
  ## interfaces and types
81
 
82
  ### `inference/docker.py`
docs/specs/04-phase-3-pipeline.md CHANGED
@@ -103,7 +103,7 @@ def run_pipeline_on_case(
103
  case_id: Case identifier (string) or index (int)
104
  dataset_id: HF dataset ID (default from settings)
105
  output_dir: Directory for results (default: temp dir)
106
- fast: Use single-model mode (faster)
107
  gpu: Use GPU acceleration
108
  compute_dice: Compute Dice score if ground truth available
109
  cleanup_staging: Remove staging directory after inference
 
103
  case_id: Case identifier (string) or index (int)
104
  dataset_id: HF dataset ID (default from settings)
105
  output_dir: Directory for results (default: temp dir)
106
+ fast: Use SEALS-only mode (ISLES'22 winner, DWI+ADC only, no FLAIR needed)
107
  gpu: Use GPU acceleration
108
  compute_dice: Compute Dice score if ground truth available
109
  cleanup_staging: Remove staging directory after inference
docs/specs/05-phase-4-gradio-ui.md CHANGED
@@ -423,8 +423,8 @@ def create_settings_accordion() -> dict[str, gr.components.Component]:
423
  with gr.Accordion("Advanced Settings", open=False):
424
  fast_mode = gr.Checkbox(
425
  value=True,
426
- label="Fast Mode",
427
- info="Use single model (faster, slightly less accurate)",
428
  )
429
  show_ground_truth = gr.Checkbox(
430
  value=True,
 
423
  with gr.Accordion("Advanced Settings", open=False):
424
  fast_mode = gr.Checkbox(
425
  value=True,
426
+ label="Fast Mode (SEALS)",
427
+ info="Run SEALS only (ISLES'22 winner, requires DWI+ADC). Disable for full ensemble (requires FLAIR).",
428
  )
429
  show_ground_truth = gr.Checkbox(
430
  value=True,
docs/specs/06-phase-5-polish.md CHANGED
@@ -145,7 +145,7 @@ class Settings(BaseSettings):
145
 
146
  # DeepISLES
147
  deepisles_docker_image: str = "isleschallenge/deepisles"
148
- deepisles_fast_mode: bool = True
149
  deepisles_timeout_seconds: int = 1800 # 30 minutes
150
  deepisles_use_gpu: bool = True
151
 
 
145
 
146
  # DeepISLES
147
  deepisles_docker_image: str = "isleschallenge/deepisles"
148
+ deepisles_fast_mode: bool = True # SEALS-only (ISLES'22 winner, no FLAIR needed)
149
  deepisles_timeout_seconds: int = 1800 # 30 minutes
150
  deepisles_use_gpu: bool = True
151