globalPeaksFilter: Reference similarity based peak selection.

View source: R/filter_global.R

globalPeaksFilterR Documentation

Reference similarity based peak selection.

Description

globalPeaksFilter returns a list of peaks selected by their similarity with a reference image.

Usage

globalPeaksFilter(
  msiData,
  referenceImage,
  method = "pearson",
  threshold = NULL,
  cores = 1,
  verbose = TRUE
)

Arguments

msiData

msi.dataset-class object. See msiDataset.

referenceImage

ms.image-class object. Reference image used to calculate the similarity values.

method

method used to calculate the similariry between the peak intensities and the reference image. Accepted values are:

  • pearson: Pearson's correlation

  • spearman: Spearman's correlation

  • ssim: structural similarity index measure

  • nmi: normalized mutual information.

threshold

numeric (default = 0, default = 0.001 (SSIM)). The threshold applied to the similarity values between the peaks images and the reference image. The default value of 0 guarantees that only the ions with a positive similarity with the reference image (typically representing the spatial distribution of the signal source) are retrieved. For consistency, the NMI are scaled in [-1, 1] to match the same range of correlations.

cores

integer (default = 1). Number of cores for parallel computing.

verbose

logical (default = TRUE). Additional output text.

Details

A filter based on the similarity between the peak signals and a reference signal. The reference signal, passed as an ms.image-class object. Both continuous and binary references can be passed. The filter then calculates the similarity between the peaks signal and the reference image and select those with a similarity larger than threshold. Multiple measures are available, correlation, structural similarity index measure (SSIM), and normalized mutual information (NMI). Since correlation can assume values in [-1, 1], also NMI are scaled in [-1, 1].

Value

peak.filter object. See applyPeaksFilter.

Author(s)

Paolo Inglese p.inglese14@imperial.ac.uk

References

Wang, Z., Bovik, A. C., Sheikh, H. R., & Simoncelli, E. P. (2004). Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4), 600-612.

Meyer, P. E. (2009). Infotheo: information-theoretic measures. R package. Version, 1(0).

See Also

countPixelsFilter applyPeaksFilter-msi.dataset-method

Examples

## Load package
library("SPUTNIK")

## Mass spectrometry intensity matrix
X <- matrix(rnorm(16000), 400, 40)
X[X < 0] <- 0

## Print original dimensions
print(dim(X))

## m/z vector
mzVector <- seq(600, 900, by = (900 - 600) / 39)

## Read the image size
imSize <- c(20, 20)

## Construct the ms.dataset object
msiX <- msiDataset(X, mzVector, imSize[1], imSize[2])

## Generate the reference image and the ROI mask
refImg <- refImageContinuous(msiX, method = "sum")

## Perform global peaks filter
glob.peaks <- globalPeaksFilter(
  msiData = msiX, referenceImage = refImg,
  method = "pearson", threshold = 0
)

## Apply the filter
msiX <- applyPeaksFilter(msiX, glob.peaks)

## Print the new dimensions
print(dim(getIntensityMat(msiX)))

paoloinglese/SPUTNIK documentation built on April 18, 2024, 8:56 p.m.