Commit 4cafecd
Add supervised WMH module: LST-AI + FreeSurfer SAMSEG (#113)
New self-contained, sourceable module src/modules/wmh_lst_samseg.sh adding
pretrained, training-data-free white-matter-hyperintensity (WMH) detection:
- run_lstai_wmh: LST-AI (deep-learning SPM-LST successor; pip/Docker, no
MATLAB). Detects CLI / importable lst_ai module (via uv) / Docker image;
runs on FLAIR+T1; produces lesion mask + probability map + volume.
- run_samseg_wmh: FreeSurfer SAMSEG (run_samseg --lesion --lesion-mask-pattern
"0 1" -i T1 -i FLAIR); extracts lesion label 99 -> binary mask + volume.
- run_supervised_wmh_lst_samseg: dispatcher running whichever tools are
enabled + available.
Both back-ends additionally intersect the whole-brain lesion mask with the
pipeline's brainstem mask (safe_fslmaths) and report brainstem-restricted WMH
separately, with a machine-readable summary per tool.
All paths degrade gracefully (WARNING + return 0) when a tool is
disabled/absent/fails, so they never abort the pipeline. The module follows
the sourced-module convention (include guard, source require_env.sh, no top
-level set -e to avoid leaking shell options into the parent) and uses
log_* / safe_fslmaths / fslstats idioms.
config/default_config.sh: add WMH_LSTAI_ENABLED/WMH_SAMSEG_ENABLED (both
default false), LSTAI_THRESHOLD/DEVICE/DOCKER_IMAGE, SAMSEG_LESION_THRESHOLD
(0.3), SAMSEG_LESION_MASK_PATTERN/LABEL/EXTRA_OPTS.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 05adf30 commit 4cafecd
2 files changed
Lines changed: 533 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
247 | 275 | | |
248 | 276 | | |
249 | 277 | | |
| |||
0 commit comments