This page is readable only by those in the LcnGroup and CmetGroup.

Samseg (cross-sectional, longitudinal, MS lesions)

This functionality is available in FreeSurfer 7, with gradual improvements appearing in the development version.

Author: Koen Van Leemput

E-mail: koen [at] nmr.mgh.harvard.edu

Rather than directly contacting the author, please post your questions on this module to the FreeSurfer mailing list at freesurfer [at] nmr.mgh.harvard.edu

If you use these tools in your analysis, please cite:

See also: ThalamicNuclei, HippocampalSubfieldsAndNucleiOfAmygdala, BrainstemSubstructures


1. General Description

Sequence Adaptive Multimodal SEGmentation (SAMSEG) is a tool to robustly segment dozens of brain structures from head MRI scans without preprocessing. The characteristic property of SAMSEG is that it accepts multi-contrast MRI data without prior assumptions on the specific type of scanner or pulse sequences used. Dedicated versions to handle longitudinal data, or to segment white matter lesions in multiple sclerosis (MS) patients are also available.

The figure below illustrates a typical SAMSEG segmentation result on a T1w-FLAIR scan of a MS patient:
3D_small.png

2. Basic SAMSEG (cross-sectional processing)

In its most basic form SAMSEG takes one or more co-registered MRI volumes as input, and produces an output segmentation in around 10 min on a good desktop computer (with multi-threading enabled). Preprocessing of the scan(s) with FreeSurfer is neither required nor recommended (e.g., no reformatting to 1mm isotropic resolution, no bias field correction and no skull stripping is needed nor recommended). The command line is:

run_samseg --input <file> [<file> ...] --output <dir> [--threads <threads>] [--pallidum-separate] 

where:

The output will consist of the following set of files, which can be found under the specified <dir> directory:

Running

run_samseg --help

will display instructions for using more advanced options, including the ability to save the full probabilistic ("soft") segmentations and skipping the initial subject-to-atlas affine registration step.

Examples:

Segment a single T1w scan using a single CPU core (e.g., for running on a cluster):

run_samseg --input /home/username/data/t1.nii --output /home/username/data/samsegOutput/ 

Segment a single T1w scan with 8 CPU cores:

run_samseg --input /home/username/data/t1.nii --output /home/username/data/samsegOutput/ --threads 8

Segment a subject with both T1w and a FLAIR scan (provided both scans are co-registered and have the same image grid size and voxel resolution -- see below) using 4 threads:

run_samseg --input /home/username/data/t1.nii /home/username/data/flair.nii --pallidum-separate --output /home/username/data/samsegOutput/ --threads 4


Co-registering multi-contrast data:

When giving multi-contrast data as input, SAMSEG expects that all contrasts have already been co-registered and reformatted to the same image grid. To avoid loss of information, it is recommended to select the contrast with the highest spatial resolution (smallest voxel size) and reformat all other contrasts to that.

FreeSurfer comes with a set of tools to perform accurate inter-modality co-registration and reformatting. For instance, given a 1x1x1mm3 T1w scan "t1.nii" and a 1x1x3mm3 FLAIR "flair.nii", coregistering and reformatting the FLAIR to the T1w can be accomplished using:

mri_coreg --mov flair.nii --ref t1.nii --reg flairToT1.lta
mri_vol2vol --mov  flair.nii  --reg flairToT1.lta  --o flair_reg.nii --targ t1.nii

SAMSEG can then be called using e.g.,

run_samseg --input /home/username/data/t1.nii /home/username/data/flair_reg.nii --pallidum-separate --output /home/username/data/samsegOutput/ 


3. SAMSEG for MS patients (cross-sectional processing)

SAMSEG comes with a dedicated extension to explicitly segment white matter lesions in multiple sclerosis patients. To use it, you need to invoke SAMSEG with a few additional flags:

* --lesion: is the flag to tell SAMSEG to segment white matter lesions.

* --lesion-mask-pattern <pattern> (optional): only considers voxels as candidate lesions if their (possibly multi-contrast) intensity satisfies certain constraints compared to the intensity of cortical gray matter. The pattern is a sequence of numbers, one number for each input contrast, with the following meaning: a value of "-1" or "1" indicates the voxels should be darker or brighter than cortical gray matter, respectively, whereas a value of "0" means that on intensity constraint is applied to the corresponding input contrast. Typically "0" would be used for T1w scans, and "1" for T2w/FLAIR scans.

* --threshold <threshold> (optional):

The first time you run this module, it will prompt you to install Tensorflow. Simply follow the instructions in the screen to install the CPU or GPU version.

If you have a compatible GPU, you can install the GPU version for faster processing, but this requires installing libraries (GPU driver, Cuda, CuDNN). These libraries are generally required for a GPU, and are not specific for this tool. In fact you may have already installed them. In this case you can directly use this tool without taking any further actions, as the code will automatically run on your GPU.