Wavelet-Based Statistical Parametric Mapping (WSPM)

Posted by admin at 12:30 PM on May 19, 2015


74.40 KB Zip Archive May 25, 2015, 8:37 PM 2658


The WSPM toolbox is implemented and maintained by Dimitri Van De Ville. The underlying theoretical framework was developed together with Michael Unser and Thierry Blu, initially at the Biomedical Imaging Group (EPFL). The main contribution of WSPM is to combine wavelet thresholding/denoising with voxel-wise statistical hypothesis testing.

These pages introduce the WSPM toolbox (wavelet-based SPM). After checking the pre-requisites, you can go on to download and install the toolbox. To understand how to use the toolbox, feel free to follow the example.

News and history

  • December, 2009: release version 1.40
    • SPM 8 compatibility
  • October 15, 2008: release version 1.32
    • Minor bugfix
  • September 2, 2008: release version 1.31
    • Minor bugfixes
    • FDR procedure working for identity transform
  • April 29, 2008: release version 1.30
    • Due to popular demand - SPM5 compatibility
  • March 17, 2008: release version 1.23
    • False discovery rate support
  • February 27, 2007: release version 1.22
    • Multi-volume support
    • Minor bugfixes
    • Complete batch support (thanks to Tom Nichols)
    • Examples can be found in WSPM.m
  • February 16, 2007: release version 1.21
    • Batch-mode to generate contrasts (results)
    • 3D DWT: different number of iterations in XY and Z supported
    • Significance volume (wspmT*.*) in the spatial domain is masked (outside mask = NaN)
    • Support for custom mask (ROI-based and corrected or uncorrected hypothesis testing)
    • Contrast volume (con*.*) in the spatial domain such that they can be used for a second-level WSPM analysis
  • October 7, 2005: release version 1.10
    • Multi-sessions compatible
    • Automatic change-dir to the working directory SPM.swd
    • Contrast volume is written without thresholding in wavelet domain to better accommodate for group analyses in near future
    • Wavelet coefficients for contrast and variance are written also to volumes now; again, these could be exploited later on for group analyses in the wavelet domain
    • Added "multiple" redundancy option for quincunx subsampling scheme
    • Added additional type of error control: False Discovery Rate
    • Bug fix for MATLAB 7.x
    • Adaptive SPM.Wavelet.wCon structure for flexible adding/removing of wavelet-related parameters of a contrast
    • Works without mask volume if it is not available
    • Detect whether DWT volumes of same transform have been computed before; asks to replace or recompute
  • April 22, 2005: release version 1.00


  1. D. Van De Ville, T. Blu, M. Unser "Integrated Wavelet Processing and Spatial Statistical Testing of fMRI Data," NeuroImage, vol. 23, no. 4, pp. 1472-1485, December 2004.
  2. D. Van De Ville, T. Blu, M. Unser "Surfing the Brain: An Overview of Wavelet-Based Techniques for fMRI Data Analysis," IEEE Engineering in Medicine and Biology Magazine, vol. 25, no. 2, pp. 65-78, March-April 2006.
  3. D. Van De Ville, M.L. Seghier, F. Lazeyras, T. Blu, M. Unser "WSPM: Wavelet-Based Statistical Parametric Mapping," Neuroimage, vol. 37, no. 4, pp. 1205-1217, October 2007.
  4. D. Van De Ville, M. Unser "False Discovery Rate for Wavelet-Based Statistical Parametric Mapping," IEEE Journal of Selected Topics in Signal Processing, vol. 2, no. 6, pp. 897-906, 2008.


The following software should be available on your system:


Before installing WSPM, check that

  • Matlab is correctly installed
  • SPM is correctly installed
    At the Matlab prompt, type:
    >> which spm
    If the filename spm.m is returned, SPM has been correctly installed

The installation of WSPM is very similar to most other SPM toolboxes:

  • Download the tarred gzip.
  • Extract the archive in your SPM/toolbox directory:
    tar zxvf WSPM.tar.gz
  • Start SPM; it should recognize automatically that a new toolbox has been installed and add it to the 'Toolboxes' drop-down menu

Example (SPM8)

We demonstrate the use of the WSPM toolbox through a case study. For that purpose, we use the 'single subject epoch auditory' data of G. Rees and K. Friston, which can be downloaded. These data were acquired on a 2T Siemens Magneton, 7s repetition time, 64x64x64 volumes with voxels of physical size 3mm x 3mm x 3mm. The block length was 6 volumes (42s) where the condition alternates between rest and auditory stimulation (bi-syllabic words presented binaurally at a rate of 60 per minute). The total number of volumes was 96, but the first 12 volumes are advised to discard due to T1 effects. This leaves us with 84 volumes or equivalently 14 cycles of 12 volumes.

In what follows, we assume that the current MATLAB directory is where the data is located. Before we can use the toolbox, we need to do a complete standard SPM analysis since we need at least one t-contrast to be available. Here, we perform a basic analysis only (realignment, smoothing, GLM).

1. Standard SPM analysis
We will use the 'batch' interface of SPM to create a pipeline including all pre-processing steps and then run all steps in one go.

1.1 Spatial preprocessing
During preprocessing, the functional data will be realigned (fM00*.imgrfM00*.img), coregistered to the structural scan, the structural scan will be segmented (sM0023_002.img; c1sM0023_002.img, c2sM0023_002.img, msM0023_002.img), both the structural and functional data will be normalised (wmsM0023_002.img, wrfM00*.img), and the functional data smoothed (swrfM00*.img).
For more information on the parameters chosen, please check chapter 28 of the SPM8 manual. For parameters that are not mentioned below, we use the default values.

  • Type >> spm fmri to start SPM and select 'Batch' in the main SPM window
  • Realign
    Add the realignment module: SPM → Spatial → Realign → Realign: Estimate & Reslice
    Data, Session: select the functional volumes fM00223_016 to fM00223_099 (84 in total)
  • Coregister
    Add the coregistration module: SPM → Spatial → Coreg → Coreg: Estimate
    Reference Image: choose ‘Dependency’ and select 'Realign: Estimate & Reslice: Mean Image'
    Source Image: select the anatomical volume scan sM0023_002
    You can use the ‘Check reg’ facility to check the results.
  • Segment
    Add the segmentation module: SPM → Spatial → Segment
    Data: Select the structural volume, i.e. sM00223_002
  • Normalise functional volumes
    Add the normalisation module: SPM → Spatial → Normalise → Normalise: write
    Data: choose ‘New: Subject', 'Parameter File', 'Dependency' and select 'Segment: Norm Params Subj->MNI'
    Images to Write: choose 'Dependency' and select 'Realign: Estimate & Reslice: Resliced Images'
    Change 'Voxel sizes' to '3 3 3' (closer to resolution at which images acquired)
  • Smooth
    Add a smoothing module: SPM → Spatial → Smooth
    Images to Smooth: choose 'Dependency' and select 'Normalise: Write: Normalised Images (Subj 1)’
    Change 'FWHM' to '6 6 6'
  • Normalise the structural volume (if you wish to overlay the functional activations on the subject’s anatomy)
    Add a second normalisation module: SPM → Spatial → Normalise → Normalise: write
    Data: choose 'New: Subject'
    'Parameter File', 'Dependency' and select 'Segment: Norm Params Subj->MNI'
    'Images to Write', 'Dependency' and select 'Segment: Bias Corr Images'
    Change 'Voxel sizes' to '1 1 3' (corresponds to original resolution of the images)

Save the designed batch and click the green arrow to run all pre-processing steps

1.2 Model specification, review and estimation
Before starting the analysis, we create a new folder (e.g. 'analysis') in the current MATLAB directory, next to the folders 'fM00223' and 'sM00223', to save the results.

  • Model Specification (1st level)
    Create a new batch in the batch editor window: File → New batch
    Add the model specification module: SPM → Stats → fMRI model specification
    Directory: select the folder you have created to save the analysis results
    Units for design: select 'Scans'
    Interscan interval: enter '7'
    Data & Design: Choose 'New: Subject/Session'
    Scans: Select volumes swrfM00223_016 to swrfM00223_099 (84 in total)
    Conditions: Choose 'New: Condition'
    Name: Enter 'active'
    Onsets: Enter '6:12:84'
    Durations: Enter '6'
  • Model Estimation
    Add the model estimation module: SPM → Stats → Model estimation
    Select SPM.mat: Choose 'Dependency' and select 'fMRI model specification: SPM.mat file'

Save the designed batch and click the green arrow to run the model specification, review and estimation

1.3 Inference: create a t contrast
Select the 'Results' option from the 'Inference' menu in the main SPM window
Select the previously created 'SPM.mat' file in the 'analysis' folder'
Select the 'Define new contrast' option in the 'SPM contrast manager' window
Name: 'T'
Type: 't-contrast'
Contrast: Enter '1 0' or only '1'
Select 'OK', pick the newly defined contrast in the contrast menu and select 'Done'
Apply masking: 'none'
Title for comparison: 'activation'
P value adjustment to control: 'FWE'
P value (FWE): 0.05
& extend threshold {voxels}: 0
Hit enter and SPM will display the results. To superimpose the functional activations on the subject’s anatomy, select ‘overlays’ in the visualisation section of the interactive window and choose ‘sections’ in the pulldown menu. Select the normalised anatomical volume wmsM00223_002

Next, we can use the WSPM toolbox to obtain results using the spatio-wavelet framework for one of the t-contrasts available.

2. WSPM analysis

2.1 Prepare data for a desired wavelet transform
Select the 'WSPM' option from the 'Toolboxes' submenu
Select the 'SPM.mat' file
Select action: choose 'Estimate (DWT+GLM)'
Select the volumes wrfM00223_016 to wrfM00223_099 (84 in total), so the non-smoothed ones!
Subsampling scheme: 'dyadic'
Transform type: '2D+Z'
Redundancy: 'Multiple'
Wavelet flavor: 'ortho'
Degree (XY-plane): 1
Number of iterations: 1

The toolbox computes the wavelet transform of all the volumes. There will also change the structure SPM in the 'SPM.mat' file; i.e., a substructure SPM.Wavelet is extended. You can compute as many transforms as you want.

2.2 Generate results
Select the 'WSPM' option from the 'Toolboxes' submenu
Select the 'SPM.mat' file
Select action: choose ‘Results (contrast)’
Select the wavelet transform: done automatically if only one available (in our example: zm*ortho,1/0,1)
Select test: done automatically if only one available (in our example: {T}: T)
Mask: 'Default'
Type 1 error control: 'Strong (Corrected Bonferroni)'
P value (significance level): '0.05'

The toolbox computes the results according to the spatio-wavelet framework and adds a traditional SPM contrast to the SPM structure.

2.3 Display results
Select the 'Results' option from the 'Inference' menu
Select the 'SPM.mat' file
Select the newly added contrast

Apply masking: 'none'
Title for comparison: hit enter (in our example 'T SIG(0.050) T(5.88) WAV(zm*ortho,1.0,1)'
P value adjustment to control: 'none'
Threshold {T or p value}: 5.88; you need to put the value that is available in the contrast title as T(XXX). This threshold value ensures that the corresponding p value is the one in the contrast title behind SIG, e.g. 0.05, using the type 1 error control you chose earlier
& extent threshold {voxels}: 0
Hit enter and SPM will display the results: WSPM guarantees a good type-I-error control because of the Bonferroni correction and there is thus strong evidence for the detected activations. Additionally, the activation patterns are more refined since the functional images are not smoothed prior to the analysis.

Naming convention for the wavelet transform:

  • Transform type: 'z' (2D+Z) or '' (3D)
  • Redundancy: '' (none) or 'm' (multiple)
  • Subsampling scheme: '' (dyadic) or 'q' (quincunx)
  • Flavor:
    • B-spline flavors (for dyadic subsampling):
      '*ortho' (symmetric orthogonal B-spline)
      '*bspline' (symmetric B-spline)
      '*dual' (symmetric dual B-spline)
      '+ortho' (causal orthogonal B-spline)
      '+bspline' (causal B-spline)
      '+dual' (causal dual B-spline)
    • Polyharmonic and McClellan flavors (for quincunx subsampling):
      'Portho' (orthogonal polyharmonic)
      'Pbspline' (Rabut polyharmonic B-spline)
      'Pdual' (Rabut polyharmonic dual B-spline)
      'PBspline' (isotropic polyharmonic B-spline)
      'PDual' (isotropic polyharmonic dual B-spline)
      'ortho' (McClellan orthogonal)
      'bspline' (McClellan B-spline like)
      'dual' (McClellan dual B-spline like)
  • Separator ','
  • Degree in the XY-plane
  • Separator '/'
  • Degree in the Z-plane (if not applicable: 0)
  • Separator ','
  • Number of iterations

For example: 'zm*ortho,1/0,1' stands for slice-by-slice symmetric orthogonal B-spline wavelet transform of degree 1, multiple redundancy, 1 decomposition level.

Naming convention for the contrasts:

  • Original SPM contrast name
  • SIG(XXX), where XXX is the significance level
  • T(XXX), where XXX is the threshold to put
  • WAV(XXX), where XXX is the wavelet transform name