Skip to content

CNN-based segmentation tool for segmenting PVS on T1 and WMH on FLAIR MRI

License

Notifications You must be signed in to change notification settings

AICONSlab/segcsvd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

segcsvd

A CNN-based tool for segmentation of white matter hyperintensities (WMH) on FLAIR MRI and enlarged perivascular spaces (PVS) on T1 MRI

UPDATE

  • 20250123: WMH segmentation now available (PVS segmentation to follow)

i) Overview

  • Purpose and Development: segcsvd was developed to improve segmentation accuracy for large-scale, heterogenous imaging datasets with varying degrees of cerebrovascular disease (CVSD) burden

  • Technical Foundation: segcsvd was developed using patient MRI and leverages FreeSurfer's SynthSeg tool (https://surfer.nmr.mgh.harvard.edu/fswiki/SynthSeg)

  • Availability: segcsvd is distributed as a docker/singularity/apptainer image

  • Citation Request: Users of segcsvd in their research are kindly requested to cite the following in their work:

    • SynthSeg: B Billot, DN Greve, O Puonti, A Thielscher, K Van Leemput, B Fischl, AV Dalca, JE Iglesias.Segmentation of brain MRI scans of any contrast and resolution without retraining. Medical Image Analysis, 83, 102789 (2023).
    • segcsvdWMH: Gibson E, Ramirez J, Woods LA, Ottoy J, Berberian S, Scott CJM, Yhap V, Gao F, Coello RD, Valdes Hernandez M, Lang AE, Tartaglia CM, Kumar S, Binns MA, Bartha R, Symons S, Swartz RH, Masellis M, Singh N, Moody A, MacIntosh BJ, Wardlaw JM, Black SE, Lim ASP, Goubran M; ONDRI Investigators, ADNI, CAIN Investigators, colleagues from the Foundation Leducq Transatlantic Network of Excellence. segcsvdWMH: A Convolutional Neural Network-Based Tool for Quantifying White Matter Hyperintensities in Heterogeneous Patient Cohorts. Hum Brain Mapp. 2024 Dec 15;45(18):e70104. doi: 10.1002/hbm.70104. PMID: 39723488; PMCID: PMC11669893.
    • segcsvdPVS: [TODO] Coming soon

Example


ii) Installation

Singularity Users

Docker Users


iii) Inputs

Images required for WMH Segmentation:

  • FLAIR image
  • FreeSurfer's SynthSeg output (version 2.0 with CSF)

Images required for PVS Segmentation:

  • T1 image
  • FreeSurfer's SynthSeg output (version 2.0 with CSF)
  • WMH segmentation (can be an empty image for populations without WMHs)

General requirements for the FLAIR/T1 input images:

  • Intensity values: should begin at 0 (background) -- negative voxels will be ignored
  • Masking and bias correction: the "skip_mask_and_bias" option should be set to false if FLAIR/T1 images are not already masked and bias corrected

iv) Running segcsvd

Overview:

  • define variables -- described in the variable setup sections below
  • execute run command -- should be copy/pasted without modification once variables are defined

Typical workflow:

  • coregister FLAIR and T1 images
  • generate synthseg image (i.e. run: mri_synthseg --i <FLAIR/T1.nii.gz> --o <synthseg.nii.gz>)
  • run WMH segmentation (section 1)
  • run PVS segmentation (section 2 - coming soon)

1. segcsvdWMH

1.1 Variable Setup

in_dir=$(pwd)
out_dir=${in_dir}
flair_fn=FLAIR.nii.gz
synth_fn=synthseg.nii.gz
sif=${HOME}/segcsvd_rc03.sif
out_fn=seg_wmh.nii.gz
seg_wmh_thr=0.35
skip_mask_and_bias=true
cleanup=true

where:

in_dir : full path to input data, or $(pwd) for current directory

out_dir : full path to the output data

flair_fn : FLAIR input filename

synth_fn : FreeSurfer synthseg input filename (output from "mri_synthseg")

sif : full path + filename of singulairty file downloaded above

out_fn : wmh segmentation output filename (with file extension)

seg_wmh_thr : threshold for binarizing WMH segmentation output

skip_mask_and_bias : true | false (true if FLAIR has been masked and bias corrected, otherwise false)

cleanup : true | false (true to remove temporary files, otherwise false)


1.2. Run Command (copy/paste)

FOR SINGULARITY/APPTAINER USERS:

singularity run \
  --bind ${in_dir}:/indir,${out_dir}:/outdir  --pwd /  ${sif}  segment_wmh  \
  /indir/${flair_fn} \
  /indir/${synth_fn}  \
  /outdir/${out_fn}  \
  1  \
  "96,128"  \
  ${seg_wmh_thr} \
  1 \
  ${skip_mask_and_bias} \
  ${cleanup} 

FOR DOCKER USERS:

sudo docker run \
  -v ${in_dir}:/indir \
  -v ${out_dir}:/outdir \
  -w / \
  segcsvd_rc03 \
  segment_wmh \
  /indir/${flair_fn} \
  /indir/${synth_fn} \
  /outdir/${out_fn} \
  1 \
  "96,128" \
  ${seg_wmh_thr} \
  1 \
  ${skip_mask_and_bias} \
  ${cleanup}

1.3. Output

  • seg_wmh.nii.gz : unthresholded WMH segmentation [0,1]
  • thr_seg_wmh.nii.gz : thresholded binarized WMH segmentation {0,1}

About

CNN-based segmentation tool for segmenting PVS on T1 and WMH on FLAIR MRI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published