MSPA (Morphological Spatial Pattern Analysis) is a customized sequence of mathematical morphological operators targeted at the description of the geometry and connectivity of the image components. Based on geometric concepts only, this methodology can be applied at any scale and to any type of digital images in any application field. The foreground area of a binary image is divided into seven generic MSPA classes: Core, Islet, Perforation, Edge, Loop, Bridge, and Branch (this demo illustrates the conceptual idea to derive the four basic classes Core, Islet, Perforation, Edge as well as an overview of the final MSPA). This segmentation results in mutually exclusive classes which, when merged, exactly correspond to the initial foreground area. 

The following image illustrates the MSPA segmentation procedure of a binary mask:

The key features of MSPA include:

  1. detection of connecting pathways,
  2. distinction of external versus internal background (detection of holes),
  3. user-driven analysis scale.

Further details on MSPA can be found in Morphological Segmentation of Binary Patterns. Additional MSPA related publications are Mapping Spatial PatternsMapping Landscape CorridorsMapping Functional ConnectivityScale Analysis, Neutral Model Analysis (1) and (2), Green InfrastructureDetecting Key ConnectorsRanking Riparian Corridors, LandscapeRestoration

MSPA benefits from expertise in mathematical morphology by Pierre Soille, EC-JRC.


  • MSPA and additional image processing software is included in the free software GuidosToolbox
  • GIS-plugin with documentation and installation script for QGIS.


  1. Preparation of the binary foreground/background mask: The expert (user) selects the appropriate input data which must provide the features of interest to be detected. The input data is then pre-processed by the expert into a binary foreground/background map, where foreground corresponds to the target of interest and background is the complement to foreground. Examples for landcover binary masks could be a forest/nonforest mask, a wetland/non-wetland mask, a grassland/non-grassland mask, etc.
  2. MSPA analysis: The user can apply the default settings for the 4 MSPA parameters or modify them in order to fine-tune the edge-width of the resulting classes and/or detect connecting elements of a pre-defined width. More information on these 4 settings can be found in the MSPA-Guide or below.
  3. Interpretation of the MSPA segmentation: The generic naming scheme of the MSPA classes may need to be amended to match the nature of the input data. For example the class Perforation is the surrounding of a foreground hole. For a forest mask, such a foreground hole could be called a forest 'opening' while for a wetland mask such a hole is an 'island' (= a hole in a lake).

The MSPA-parameters can be amended to increase the edge-width of the resulting classes, or the user could perform a second analysis using a revised definition of foreground/background. 


The following images show the effects of changing the 4 MSPA-parameters Foreground ConnectivityEdgeWidthTransition, and Intext. More details on these 4 MSPA-parameters can be found in the MSPA-Guide within GuidosToolbox.


MSPA-parameter 1, Foreground Connectivity: the white circles show the difference when using 8- (left image) or 4-connectivity (right image) for Foreground Connectivity.


MSPA-parameter 2, EdgeWidth: increasing the EdgeWidth will increase the non-core area at the expense of the core-area and may change the pattern class (white circles). Changing the EdgeWidth has no impact on the total foreground coverage.


MSPA-parameter 3, Transition: transition can be set to either show connecting elements into core area (white circles, left image) or hide these transition pixels to maintain closed perimeters for the classes perforation and edge.


MSPA-parameter 4, Intext: Intext can be used to add a second layer of classes inside perforations to the 7 basic classes (see the pixel value examples). When Intext is on (1) a pixel offset of 100 is added to the feature classes in the internal areas of the foreground objects. More details on Intext including a detailed table with pixel values can be found in the MSPA-Guide included in GuidosToolbox. 

Parameter 4: Intext (811 <Intext>).
Left: Intext on (8111). Right: Intext off (8110)


The following images illustrate MSPA examples for

Example 1: MSPA detecting connecting structures: a water mask in Finland: 
lakes (blue), rivers connecting more than one lake (red), rivers feeding one lake only (green), islands (yellow).


Example 2: MSPA detecting connecting structures: Lost in a maze? No problem, let MSPA find the way out!


Example 3: MSPA detecting external/internal background (holes): Example of deforestation in the Amazon, Rondonia, Brazil. Forest perforations (blue) and other pattern classes; exported as Google Earth image overlay using GuidosToolbox.

Example 4: MSPA in manufacturing quality control: Example of simulated manufacturing defects on a circuit board:
Upper circle: introduction of a hole and a mis-aligned via. Bottom circle: opening the left ring structure changes the class loop into branch. Filling the right ring structure changes the class loop into core and bridge. 
The comparison of a MSPA image against a MSPA-template can be used to detect incorrectly-sized, misplaced, insufficient, damaged, or missing components in manufacturing.

Example 5: MSPA in medical images: Example of X-ray of Homer Simpson:
Brain showing impact of too much Duff but the connection to the brain is still active... Similarly, deviations from a pre-defined thickness can be detected, e.g., thinning or thickening of arteries.

Example 6: MSPA for climate change analysis: Spatial pattern of Sea-Ice showing openings (yellow) in a large ice-field (ENVISAT-Meris, 29/08/2006).


Example 7: MSPA in oceanography: Identification of zooplankton.


Contact: Peter Vogt




As the science and knowledge service of the European Commission, the Joint Research Centre's mission is to support EU policies with independent evidence throughout the whole policy cycle.