38. White Matter Lesion Segmentation on FLAIR MRI

38.1. WML Segmentation Overview

White matter hyperintensities in the brain and spinal cord are regions of high signal relative to healthy white matter (WM) on T2-weighted fluid attenuated inversion recovery (FLAIR) MRI (see T2-FLAIR at MRI Questions and Radiopaedia). These white matter lesions (WML) are often found in patients with multiple sclerosis and are also commonly seen in older individuals (White Matter Lesions - NIH Bookshelf). Detecting WML and measuring their size and location helps to assess the extent of WM disease (Fig. 38.1).

White Matter Lesions Segmentation on Axial View

Fig. 38.1 WML manually segmented (yellow ROI) on axial FLAIR image.

FireVoxel offers automatic workflows for WML segmentation on FLAIR MRI for individual series and batch mode processing for multiple series.

The WML and ventricle segmentation masks may be used for classification of WML as periventricular and deep lesions. It has been shown that periventricular lesions are more strongly associated with cognitive decline, and therefore knowing the location of WML in relation to the ventricles may help to characterize the subject’s neurological status. Currently, the WML classification may be done with the help of the 3D “bilateral distance” method (Chen 2021 PMID: 33127308), available as open-source software (GitHub: WMHS). The implementation of this method in FireVoxel is under development.

The WML segmentation workflow includes the following steps:

  1. Nonuniformity correction (optional).

  2. Whole-brain segmentation using EdgeWave.

  3. Lateral ventricle segmentation (with multi-pass EdgeWave and advanced morphology operators).

  4. White matter segmentation – WM is segmented by excluding gray matter (GM) from the whole-brain mask. GM segmentation can be done by

    1. using a previously created GM mask, or

    2. loading the subject’s T1-weighted magnetization-prepared rapid gradient echo (MPRAGE) image and using it to automatically segment GM, or

    3. specifying the width of a uniform region to be excluded from the outer edge of the whole-brain mask (using Peel command).

  5. “Healthy” WM sampling – The signal is sampled in uniform, lesion-free WM to determine its mean and standard deviation (mean_WM and stdev_WM, respectively). Healthy WM signal may be sampled using one of two available methods:

    • Using a WM seed (default) – The signal is sampled within a WM seed, a small (1 mL) cubic vector ROI automatically created in the most uniform area of WM.

    • Using the whole WM – The whole WM is sampled. It is assumed that WML occupy a small volume compared to the whole WM and do not distort the distribution of the WM signal.

  6. Identifying WML candidates – WM voxels are marked as WML if their signal exceeds threshold_WML = mean_WM + k x stdev_WM, where k is a user-selected multiplier. This step results in a preliminary WML segmentation.

  7. Filtering WML based on size and location – Cortical lesions and lesions smaller than a user-specified minimum size are removed from the preliminary segmentation. The final WML segmentation is created.

  8. Returning segmentation results in new, automatically created layers.

38.2. WML Segmentation Input Data

Segmentation of a single FLAIR series takes the following input data:

  1. FLAIR MRI (required) – 3D FLAIR MR image (usually in DICOM or NIfTI format).

  2. Gray matter segmentation mask (optional) – The GM mask (ROI layer) must be created beforehand using FireVoxel or another software tool (such as FreeSurfer or SPM), coregistered with FLAIR image, and placed as a layer into the same document as FLAIR MRI. This layer should be named gray matter or GM (case insensitive).

  3. MPRAGE MRI (optional) – T1-weighted 3D MPRAGE MR image (usually in DICOM or NIfTI format). This MPRAGE image must be opened in a separate document window within the same instance of FireVoxel as FLAIR. This is an alternative method to perform GM segmentation within the same command as WML segmentation. If both MPRAGE and GM mask are present, GM mask is used.

38.3. Processing a Single FLAIR Series

To segment one FLAIR series at a time, first, prepare input data. Open FLAIR image in FireVoxel and, optionally, load GM mask into the same document window or open MPRAGE image in another document window. Make sure that FLAIR image is the active layer.

Next, select Workflows > Brain MR > White Matter Flair Lesions (v391). This will open WML dialog described below. Enter the parameters, or accept defaults, and click OK. The command will run automatically and return outputs described in WML Segmentation Output.

38.4. WML Segmentation Dialog

Both individual and batch commands use the same dialog: White Matter Lesions Segmentation (FLAIR) Using Lateral Ventricle (Fig. 38.2).

White Matter Lesions Segmentation Dialog

Fig. 38.2 White Matter Lesions Segmentation dialog with default parameters.

The dialog panel contains blocks that closely match the workflow steps described in Overview:

  • Nonuniformity correction

  • Gray matter (GM) segmentation

  • MPRAGE processing

  • Brain mask EdgeWave

  • Lateral ventricle

  • Healthy White Matter signal meanstdev

  • [WML selection by size and location]

Nonuniformity correction (checkbox, default: checked) – When checked, the N3 nonuniformity correction is performed prior to WML segmentation. Using nonuniformity correction is recommended, as it may considerably reduce the number of false positives, especially in deeper regions of the brain.

N3 Parameters (button) – Opens N3 dialog to configure the nonuniformity correction parameters.

Use provided Gray Matter mask (checkbox, default: unchecked) – Check this box to use a previously created GM segmentation mask (see WML Input Data).

MPRAGE processing (default: inactive) – This block is activated when MPRAGE image series is detected in another document window. When MPRAGE is present, the name of the MPRAGE image series is displayed in the text box below the section title. The user must then check the box labeled Use MPRAGE and configure coregistration of MPRAGE to FLAIR to perform the GM segmentation using MPRAGE. If both MPRAGE and GM mask are present (and Use provided Gray Matter mask is checked), the algorithm uses the GM mask and ignores MPRAGE.

Use MPRAGE (checkbox, default: unchecked) – When checked, MPRAGE image are coregistered with FLAIR and used to segment GM. FireVoxel uses Gaussian mixture model applied to the whole-brain mask (Mikheev and Rusinek, ISMRM 2023, Abstract #3602).

The parameters of MPRAGE/FLAIR coregistration can be configured by clicking Registration Parameters (see next).

Registration Parameters (button) – Opens the image coregistration dialog (3D Registration with AutoFocus). The dialog enables user to set up the coregistration parameters of MPRAGE (source) to FLAIR (target). If both image series were acquired during the same exam, the best option for the initial transform is clicking Dicom Tags. This command creates a volume transform file DicomTags.vtf in FireVoxel’s Temp directory with the dimensions and resolution of the source (MPRAGE) and target (FLAIR) images and the affine transform matrix computed based on the orientation and position DICOM fields of these files (Fig. 38.3). This transformation is then used for the initial coregistration.

Volume Transform File for MPRAGE to FLAIR coregistration with DICOM tags

Fig. 38.3 A volume transform file for MPRAGE to FLAIR coregistration based on DICOM tags.

38.4.1. Brain mask EdgeWave

This block contains parameters of the whole brain segmentation of FLAIR image using EdgeWave (see Segmentation with EdgeWave).

Note: The whole-brain mask resulting from this step does not include CSF-filled spaces.

Signal low (relative to WM) – Lower threshold for signal intensity of the whole brain as a fraction of the mean WM signal (default: 0.4).

Peel (mm) – Whole-brain Peel distance – The thickness of the region to be removed by the Peel command (default: 2.9 mm).

Grow (mm) – Whole-brain Grow distance – The thickness of the region to be added by the Grow command (default: 6.4 mm).

38.4.2. Lateral ventricle

This block sets the parameters of the lateral ventricle segmentation.

Peel (mm) – Ventricle Peel distance – The width to be removed by the Peel command during ventricle segmentation (default: 2 mm). Which mask?

Grow (mm) – Ventricle Grow distance – The width to be added by the Grow command during ventricle segmentation (default: 3 mm).

Max number CC – Maximum number of connected components in the ventricle mask (default: 1).

Periventricular border (mm) – The width to be added around the edge of the ventricle mask by Grow command to ensure that no GM is detected in this inflated mask (default: 5 mm).

38.4.3. Healthy White Matter signal mean\stdev

This block sets up the WM segmentation and the signal threshold used to identify WML.

Use WM seed (uncheck for using healthy WM mask) (checkbox, default: checked) – When this box is checked, the algorithm automatically creates a 1-mL vector ROI in the most uniform region of WM. The signal mean and stdev within the seed are used to determine the threshold for WML segmentation. The seed is then deleted (so the user never sees it).

If the Use WM seed box is unchecked, the whole WM is used to determine signal mean and stdev. See this Important Note on selecting the multiplier for thresholding when using WM seed or whole WM.

Brain mask EdgeWave signal high (relative to WM) – Upper threshold of brain signal relative to the average WM signal (default: 1.5).

Peel Brain mask to obtain healthy WM voxels (mm) – The thickness of the region between the outer edge of the brain mask and the edge of healthy WM to be excluded from the whole brain mask by the Peel command (default: 5 mm).

WML threshold stdev multiplier – As described in Overview, the algorithm looks for WML voxels with signal above threshold_WML = mean_WM + multiplier x stdev_WM. Larger multiplier values result in fewer and smaller lesions being found.

Important Note: A higher value of the multiplier is needed when using the WM seed option compared to the no-seed (whole WM) option to reduce the number of false positives, which may arise if the WM seed is hypointense and uniform compared to the rest of WM.

38.4.4. WML selection by size and location

The last block sets the parameters to exclude those WML that are located in the cortex and those smaller than a user-selected minimum volume.

Peel to exclude cortical lesions (mm) – Thickness of the area along the edge of the WM mask to be removed by the Peel command in order to exclude voxels with high-intensity FLAIR signal located in the cortex and probably not lesions (default: 3 mm).

WML minimal size (mm^3) – Lower threshold for WML size (default: 12 mm^3). In the final segmentation step, scattered WML voxels or clusters of voxels below this threshold are removed from the WML mask.

38.5. WML Segmentation Output

The command automatically creates several new layers (Fig. 38.4):

FireVoxel's White Matter Lesions Segmentation

Fig. 38.4 FireVoxel’s WML segmentation performed using MPRAGE (axial and sagittal views; red - WML, blue - GM, green - ventricle).

WML_thr_xxxx (ROI layer) – WML segmentation mask. The threshold signal is shown in the layer name after “thr_”.

gray matter (ROI layer) – When MPRAGE is used, GM segmentation mask is created as one of the output layers.

lateral ventricle (ROI layer) – Ventricle segmentation mask.

38.6. Batch Mode Processing of Multiple FLAIR Series

To segment WML on multiple FLAIR series in batch mode, use FireVoxel without any images open and select Applications > White Matter Lesions (FLAIR-MPRAGE) batch measurement from DICOM.

Note: White Matter Lesions (FLAIR) batch measurement is a legacy command - do not use.

The batch command opens a dialog to select the source and target (input and output) directories (Fig. 38.5, top). The source directory is expected to contain subfolders, each of which should contain a folder with 3D FLAIR series in DICOM format (Fig. 38.5, bottom). The target directory is where the results are saved as FireVoxel documents (*.fvx). If this directory is not empty, the user will see a warning that its contents will be overwritten by the new results.

After selecting the directories, click OK.

White Matter Lesions Batch Mode Folder Selection Dialog

Fig. 38.5 WML batch mode dialog to select input and output folders (top) and expected folder structure of input data (bottom). The source directory (batch_data_in) contains 3 folders (for subjects labeled b, d, and e), each containing folders with FLAIR and MPRAGE series.

Next, the WML segmentation dialog will open to set up the segmentation parameters (see WML Dialog). Select parameters and click OK to start processing. If MPRAGE images are to be used for GM segmentation, click Use MPRAGE. If any of the input data folders contain no MPRAGE, segmentation will be performed without using MPRAGE.

After processing is completed, the results will appear in the target directory, saved as FireVoxel documents, with each subject’s results in its own document, containing FLAIR images, WML segmentation masks, and GM masks (if MPRAGE was used) in different layers. The results log is written into a text file in FireVoxel’s Temp directory (\FireVoxel\Temp\NotepadTempFile.txt). This file contains a list of processing parameters followed by tab-delimited processing results (Fig. 38.6).

White Matter Lesions Batch Results Log

Fig. 38.6 WML batch mode results log saved as NotepadTempFile.txt in FireVoxel’s Temp directory.

Results log entries:

Parameters

Results

caseID – The name of the individual subject’s input data directory

Mprage used – Whether MPRAGE was found and successfully used

WML_volume(cm3) – WML total volume

WML_signal – Mean WML signal

WMLthr – WML threshold signal

WM_signal – Mean wealthy WM signal

time – Processing time for a given case

Status – Whether processing was completed normally