Description           Download          Workflow            MSPA-Parameters     MSPA-Examples  


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 visually distinguished MSPA classes: Core, Islet, Perforation, Edge, Loop, Bridge, and Branch. The MSPA segmentation results in 23 mutually exclusive feature classes which, when merged, exactly correspond to the initial foreground area. More details are illustrated in the MSPA-Guide and the morphology product sheet

MSPA and additional image processing software is included in the free software GTB (GuidosToolbox) and GWB (GuidosToolbox Workbench). MSPA is open source and the source code requires miallib. The source code of the GTB/GWB-amended version of mspa, fsp.c, is available on GitHub.

MSPA reference paper: Soille P. and Vogt P. (2009). Morphological segmentation of binary patterns. Pattern Recognition Letters 30, 4:456-459, doi: 10.1016/j.patrec.2008.10.015 

MSPA open source reference paper: Soille P. and Vogt P. (2022). Morphological spatial pattern analysis: open source release. The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-4/W1-2022 Free and Open Source Software for Geospatial (FOSS4G) 2022 – Academic Track, 22–28 August 2022, Florence, Italy. pp. 427-433, doi:

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 CorridorsLandscapeRestoration, Classifying Zooplankton.

Download (current MSPA-version: 2.3): 

GIS-plugin with documentation and installation info for ArcGISQGIS3 and R. Note: These plugins are do not provide the full feature set, please use GTB or GWB instead.

If you use MSPA, please add the following reference: 
Soille P, Vogt P, 2009. Morphological segmentation of binary patterns. Pattern Recognition Letters 30, 4:456-459, DOI: 10.1016/j.patrec.2008.10.015

IMPORTANT: MSPA results in 23 feature classes, see page 6 in the MSPA-Guide. In many cases, fewer classes are sufficient, which can be derived with the Simplified Pattern Analysis (SPA), see page 9 in the MSPA-Guide.


  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: 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 of individual pixels. Note: changing the value of EdgeWidth has no impact on the total foreground coverage.

MSPA-parameter 3: Transition: Transition pixels are loop or bridge pixels that traverse an edge or a perforation to connect to the core area.  The MSPA parameter 3 Transition can be set to either show (left panel) or hide these transition pixels, for example to maintain closed perimeters for the classes perforation and edge (right panel). Note: changing the value for Transition will use a different color table only. The actual pixel values of the MSPA segmentation are identical and independent of the selected setting for Transition.

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=1 (left panel) a pixel offset of 100 is added to the feature classes in the internal areas of the foreground objects surrounded by Perforation pixels. More details on Intext including a detailed table with pixel values can be found in the MSPA-Guide. When using the default setting Intext=1, the internal part of Background is further segmented into the two categories Core-Opening and Border-Opening (bottom panel).

MSPA examples:

The following images illustrate MSPA examples for

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).

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


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.


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.

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.


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

7) MSPA in oceanography: Identification of zooplankton.

Contact: peter.vogt[at]