UCL logo




Using the spm_segment program

The spm_segment program estimates the volume of grey matter, white matter and CSF from 3D MRI images of the brain. If a lesion mask is supplied, the lesion volume will also be calculated. spm_segment is an extension to SPM and uses SPM algorithms as the basis for volume estimation.

The method is a platform independent implementation of a well validated method. For details, see method and references.

Important: spm_segment is provided for research purposes only; it is not a medical device and should not be used for medical purposes

Information for local users

Users within the NMR Group may refer to the Atrophy Processing Instructions which is specific to software available in the Institute and covers UNC to Analyze conversions etc.


Images are expected to be in axial orientation with the brainstem at low slice numbers.

Lesion contouring is recommended if the images contain lesions, for example, multiple sclerosis. Use an image editing program to outline lesions and create a binary mask for each image (non-zero within the lesion volume, zero elsewhere).

Axial cutoff slices may be applied if desired. For each image, identify the most cranial slice through the brainstem not containing cerebellum. The effect of applying axial cutoffs is discussed here.

Using spm_segment to estimate brain volume

Choose from one of the following methods to launch the graphical interface:

  • Either, from a running SPM window:
    • Start SPM
    • Select "Run mFile" from the "Utils..." menu
    • Locate the spm_segment_i.m file in the spm_segment installation directory
    • Press "Done"
  • OR, from the command line:
    • Type spm_segment -i

Once the graphical interface is on the screen, you will be presented with the following options:

  • Calculation Method
    • Choose make_SPM_seg_masks for an implementation of the method described in our publications. Other methods are currently experimental
  • File select dialog
    • Select the images for volume estimation
  • Use lesion masks
    • Choosing yes will bring up a file selection dialog to input the lesion mask files
    • Mask files must be selected in the same order as the images were selected
    • Pixels which have non-zero intensity in the lesion masks are classified as 'lesion' in the volume estimation
  • Modality
    • Select the correct modality for your MR images
  • Use brainstem cutoff
    • Choosing yes will prompt you for slice numbers below which tissue should be excluded from the volume estimation
  • Show graphical windows
    • Choosing no will suppress graphical progress bars, which may increase processing speed
    • In this case progress information will be printed in the Matlab window, or a command line terminal
Estimated volumes are saved in a file named seg_volumes.txt in the same folder as the images

Batch processing with the command line interface

For UNIX based systems (includes Linux, Mac OS X and Cygwin) a command line interface is provided. The usage is as follows:

Performs SPM segmentation followed by volume estimation
Volume estimates are saved in a file called 'seg_volumes.txt'
All images should be in Analyze format

usage 1:  spm_segment [-v ] -i
  Interactive mode: starts SPM and requests user input

usage 2:  spm_segment [options] 
  Process single image; Options:
    -a        "0" for make_SPM_seg_masks method (default)
                      "1" for sequential maximum likelihood
    -c        brainstem cutoff slice(default = 0)
                        (assumes brainstem is at LOW slice numbers)
    -e                save brain mask image (SPM99 only)
    -l   Lesion mask. Non zero pixels indicate lesion.
    -m      Template - "T1"(default), "T2", "PD" or "EPI"
    -s                save SPM probability maps in addition to
                        binary mask files. (default: dont save)
    -t     binary mask threshold (default = 0)
    -v       SPM version - "SPM99"(default), "SPM2" or "SPM5"
    -x       Matlab version - options are "6" or "7"

usage 3:  spm_segment [options] -f 
  Read image list from file; Options:
    -m -s -t -v       -> see usage 2
   should contain  followed by  and
   in this order. Entries are separated by spaces
  with each  on a new line

Please reference 'Chard et. al. (J Magn Reson Imaging, 2002, 15, 259-267)'
and the web site http://www.nmrgroup.ion.ucl.ac.uk/atrophy/ in publications
This software comes with no warranty, expressed or implied
This software is not suitable for medical purposes;
  it is provided for research purposes only

Segmented Brain Image

Last modified by Jon Jackson on Wed Dec 31 11:06:47 GMT 2008

NMR Research Unit - Institute of Neurology - Queen Square House - Queen Square - London - WC1N 3BG - UK - Telephone: +44 (0)20 7829 8771 - Fax +44 (0)20 7278 5616 - Copyright © 1999-2009 UCL

Search by Google