Mini-tutorial: how to overlay NMF components of an imaging mass spec dataset using simsMVA

For this tutorial you will be using the example data “Adhesive” from the examples menu in simsMVA. The data consists of secondary ion maps of the surface of a packaging adhesive. The aim is to produce the following figure:


Where the left-hand side contains an overlay of three NMF components intensities and the right-hand side contains their characteristic spectra.

To load the example dataset, click on “Examples” on the top menu and select “Imaging (Adhesive)”, then click on the new tab created.


Pre-process the data by normalising all maps by total ion counts and Poisson-scaling. Choose a more appropriate colour map that would help to identify whether everything is OK with the pre-processed data.


For this example, NMF was performed in a subset of only 3% of the pixels. This is done by selecting “Sample 3%” in the subsampling drop-down menu, then click the “NMF” Slide7  button and set the input parameters:

  • algorithm: multiplicative (normal)
  • number of components: 3
  • number of iterations: 500
  • tick the box “Calculate lack-of-fit”

A new tab is then created with the NMF results. Click on it.


Now we have the data needed for the overlay. To produce it, click the “Overlay” button on the “Components” panel. If you intend to print it or include it in a white-background slide, change simsMVA colour scheme by clicking “Theme” on the top menu bar and selecting a white background theme such as “Almond Milk”.

The “Overlay” window consists of three panels: “Control”, “Overlay” and “Components”. On the “Control” panel, the “Add” buttons allow you to add individual components to the overlay and the coloured button next to it sets their respective colours.  For this image, a base colourmap (“hsv”), without much tweaking, was enough to produce good results. In cases where there are more than three components, you may want to tweak the colours of a base colourmap in order to enhance contrast.


Note that the plots on the right-hand side are connected, so if you use the magnifying lens maglens to zoom in any of the plots, all three plots will show the same x-scale.


Once you are happy with the colour and sizes, you can export the figure by clicking “File->Export setup…”, select appropriate rendering and export it to your desired compression format.



A bit of background

Non-negative matrix factorisation (NMF)1,2 is a non-supervised machine learning method that seeks to reduce the dimensionality of a dataset down to a few “pure” components. For the application of NMF to ToF-SIMS images, the data is unfolded into a Matrix A containing samples (pixels) in rows and variables (spectral channels) in columns. The method then finds an approximate factorisation AWH into non-negative factors W and H. H is interpreted as the characteristic spectra of components and W is interpreted as the “concentration” distribution of the components over the samples. The number of components is defined by the inner dimension of the product WH, as shown in the figure below:


  1. D. Lee, H. Seung, Algorithms for non-negative matrix factorization, Adv. Neural Inf. Process. Syst. (2001) 556–562. doi:10.1109/IJCNN.2008.4634046.
  2. G.F. Trindade, M. Abel, J.F. Watts, Non-negative matrix factorisation of large mass spectrometry datasets, Chemom. Intell. Lab. Syst. 163 (2017) 76–85. doi:10.1016/j.chemolab.2017.02.012.

New magnify feature of simsMVA

In simsMVA, it is now possible to magnify specific regions of a loadings/characteristic spectrum. Simply click on “Magnify”, select a start and end mass and the magnification factor. To go back to the original data, click on “Reset” (GIF below).


(mag function)

Updates 21/03/2018

– Several bug fixes in imaging and 3D mode

– Scores and loadings plot now show the percentage of variance captured

– Improved scaling. Poisson scaling now is reverted so that results look more like spectra. The old-styled results can be obtained using the “square root” scaling method.

– Custom themes: user can select two base colours to make up a visual theme.

simsmvashot (Darth Nicolas theme)