Skip to content

code for WMH-DualTasker: Jointly Weakly-Supervised White Matter Hyperintensity Segmentation and Visual Rating with Self-Supervised Consistency

Notifications You must be signed in to change notification settings

hzlab/WMH-DualTasker

 
 

Repository files navigation

WMH-Dual Tasker

Overview

WMH-Dual Tasker performs both white matter hyperintensity (WMH) visual rating and segmentation from FLAIR MRI volumes using a single deep learning model.

Setup

  1. Clone the Repository:

    git clone https://github.com/yilei-wu/WMH-DualTasker.git
    cd WMH-DualTasker
  2. Install Dependencies:

    pip install torch torchvision nibabel numpy scipy scikit-learn matplotlib tqdm

Model Download

Download the pre-trained model weights:

  • Model weights: Download here
  • Place the downloaded .pth file in your desired location

Inference

Use the inference.py script to get both visual rating score and WMH segmentation from FLAIR volumes:

Basic Usage

python inference.py --input /path/to/flair_volume.nii.gz \
                   --model_path /path/to/model_weights.pth

With Brain Mask

python inference.py --input /path/to/flair_volume.nii.gz \
                   --model_path /path/to/model_weights.pth \
                   --brain_mask /path/to/brain_mask.nii.gz \
                   --normalize

Parameters

  • --input: Path to FLAIR volume (.nii/.nii.gz/.npy)
  • --model_path: Path to downloaded model weights (.pth)
  • --brain_mask: Brain mask (optional, improves accuracy)
  • --output_dir: Output directory (default: ./wmh_output)
  • --normalize: Apply intensity normalization (recommended)
  • --model_type: Model architecture (default: sfcn_rep1)

Outputs

  • visual_rating.txt: Visual rating score (0-30 scale)
  • wmh_segmentation.nii.gz: Binary WMH mask

Requirements

  • Input: FLAIR T2-weighted MRI volume
  • Format: NIfTI (.nii/.nii.gz) or NumPy (.npy)
  • Hardware: GPU recommended

Contact

For questions or issues, contact Yilei Wu.

About

code for WMH-DualTasker: Jointly Weakly-Supervised White Matter Hyperintensity Segmentation and Visual Rating with Self-Supervised Consistency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%