Differences between revisions 9 and 10
Deletions are marked like this. Additions are marked like this.
Line 119: Line 119:
Please note that the label values follow the FreeSurfer classification. Also, we do not provide any colour scheme,
as the colour displayed for each structure depends on the used image viewer.
Please note that the label values follow the FreeSurfer classification.
We emphasise that the structures are given in the same order as they appear in the posteriors, i.e. the first map of the
posteriors corresponds to the background, then the second map is associated to the left cerebral white matter, etc.
Also, we do not provide any colour scheme, as the colour displayed for each structure depends on the used image viewer.
Line 155: Line 157:

We emphasise that the structures are given in the same order as they appear in the posteriors, i.e. the first map of the posteriors
corresponds to the background, then the second map is associated to the left cerebral white matter, etc.

SynthSeg

This functionality is only available in the development version of FreeSurfer.

Author: Benjamin Billot

E-mail: benjamin.billot.18 [at] ucl.ac.uk

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:


Contents

  1. General Description
  2. Installation
  3. Usage
  4. Frequently asked questions (FAQ)
  5. List of segmented structures


1. General Description

This tool implements SynthSeg, the first convolutional neural network for segmentation of brain MRI scans of any contrast and resolution, without retraining or fine-tuning. Additionally, as shown in the figure below, the proposed model is robust to:

  • a wide array of subject populations: from young and healthy to ageing and diseased subjects with prominent atrophy,
  • white matter lesions (see green arrows),
  • and scans with or without preprocessing (bias field corruption, skull stripping, intensity normalisation, registration to template).

As a result, SynthSeg only relies on a single model, which we distribute here. The output segmentations are returned at high resolution (namely 1mm isotropic resolution), regardless of the resolution of the input scans. We emphasise that this model can be used out-of-the-box without retraining or fine-tuning, and can run on the GPU (6s per scan) as well as the CPU (1min). An exhaustive list of the segmented structures is given at the bottom of this page.


segmentations.png

2. Installation

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.


3. Usage

You can simply use SynthSeg with the following command:

mri_synthseg --i <input> --o <output> --post <post> --resample <resample> --vol <vol> --cpu --threads <threads> --crop <crop>

where:

  • <input>: is the path to a scan to segment. This can also be a folder, in which case all the scans in this folder will be segmented.

  • <output>: is the path where the output segmentation will be saved. This must be a folder if --i designates is a folder.

  • <post>: (optional) is the path where the posteriors (given as soft probability maps) will be saved. This must be a folder if --i designates is a folder.

  • <resample>: (optional) in order to return segmentations at 1mm resolution, the input images are internally resampled to this resolution (except if they already are at 1mm resolution). Use this optional flag to save the resampled images. This must be a folder if --i designates is a folder.

  • <vol>: (optional) is the path to an output CSV file where the volumes of every segmented structures will be saved for all scans.

  • --cpu: (optional) use this flag to enforce running with CPU rather than GPU.

  • <threads>: (optional) number of threads to be used by Tensorflow (default uses one core). Increase it to decrease the runtime when using the CPU version.

  • <crop>: (optional) to crop the inputs to a given shape before segmentation. This must be divisible by 32. It can be given as a single (i.e., --crop 160) or several integers (i.e, --crop 160 128 192, ordered in RAS coordinates). This value defaults to 192, decreased it for faster analysis or to fit in your GPU.

Important: If you wish to process several scans, we highly recommend that you put them in a single folder, rather than calling SynthSeg individually on each scan. This will save the time required to set up the software for each scan.


4. Frequently asked questions (FAQ)

  • Does running this tool require preprocessing of the input scans?

No! Because we applied aggressive augmentation during training (see paper), this tool is able to segment both processed and unprocessed data. So there is no need to apply bias field correction, skull stripping, or intensity normalization.

  • The sum of the number of voxels of a given structure multiplied by the volume of a voxel is not equal to the volume reported in the output volume file.

This is because the volumes are computed upon a soft segmentation, rather than the discrete segmentation. The same happens with the main recon-all stream: if you compute volumes by counting voxels in aseg.mgz, you don't get the values reported in aseg.stats.

  • What formats are supported ?

This tool can be run on Nifti (.nii/.nii.gz) and FreeSurfer (.mgz) scans.

  • How can I increase the speed of the CPU version without using a GPU?

If you have a multi-core machine, you can increase the number of threads with the --threads flag (up to the number of cores). Additionally you can also try to decrease the cropping value, but this will also decrease the field of view of the image.

  • Why are the inputs automatically resampled to 1mm resolution ?

Simply because, in order to output segmentations at 1mm resolution, the network needs the input images to be at this particular resolution! We actually do not resample images with resolution in the range [0.95, 1.05], which is close enough. We highlight that the resampling is performed internally to avoid the dependence on any external tool.

  • Why aren't the segmentations perfectly aligned with their corresponding images?

This is probably of problem of image viewer, in the case where the images have been resampled to 1mm resolution. Indeed, if images are resampled, their segmentations are given at 1mm resolution (so not the same as the input image), and some viewers cannot cope with resolution changes. In that case we recommend to use the --resample flag to save the resampled images, or simply to use FreeView (shipped with FreeSurfer), which is resolution-aware !


5. List of segmented structures

Please note that the label values follow the FreeSurfer classification. We emphasise that the structures are given in the same order as they appear in the posteriors, i.e. the first map of the posteriors corresponds to the background, then the second map is associated to the left cerebral white matter, etc. Also, we do not provide any colour scheme, as the colour displayed for each structure depends on the used image viewer.

Labels

Structures

0

background

2

left cerebral white matter

3

left cerebral cortex

4

left lateral ventricle

5

left inferior lateral ventricle

7

left cerebellum white matter

8

left cerebellum cortex

10

left thalamus

11

left caudate

12

left putamen

13

left pallidum

14

3rd ventricle

15

4th ventricle

16

brain-stem

17

left hippocampus

18

left amygdala

26

left accumbens area

28

left ventral DC

41

right cerebral white matter

42

right cerebral cortex

43

right lateral ventricle

44

right inferior lateral ventricle

46

right cerebellum white matter

47

right cerebellum cortex

49

right thalamus

50

right caudate

51

right putamen

52

right pallidum

53

right hippocampus

54

right amygdala

58

right accumbens area

60

right ventral DC

SynthSeg (last edited 2021-10-26 05:07:23 by BenjaminBillot)