Learn R Programming

Cardinal (version 1.4.0)

smoothSignal-methods: Smooth the Feature-Vectors of an Imaging Dataset

Description

Apply smoothing to a mass spectrometry imaging dataset.

Usage

## S3 method for class 'MSImageSet':
smoothSignal(object, method = c("gaussian", "sgolay", "ma"),
    ...,
    pixel = pixels(object),
    plot = FALSE)

## Gaussian smoothing smoothSignal.gaussian(x, sd=window/4, window=5, ...)

## Savitsky-Golay smoothing smoothSignal.sgolay(x, order=3, window=order + 3 - order %% 2, ...)

## Moving average smoothing smoothSignal.ma(x, coef=rep(1, window + 1 - window %% 2), window=5, ...)

Arguments

object
An object of class MSImageSet.
method
The smoothing method to use.
pixel
The pixels to smooth. If less than the extent of the dataset, this will result in a subset of the data being processed.
plot
Plot the mass spectrum for each pixel while it is being processed?
...
Additional arguments passed to the smoothing method.
x
The mass spectrum to be smoothed.
sd
The standard deviation for the Gaussian kernel.
window
The smoothing window.
order
The order of the smoothing filter.
coef
The coefficients for the moving average filter.

Value

  • An object of class MSImageSet with the smoothed spectra.

Details

Smoothing is usually performed using the provided functions, but a user-created function can also be passed to method. In this case it should take the following arguments:

  • x: Anumericvector of intensities.
...: Additional arguments.

See Also

MSImageSet, pixelApply

Examples

Run this code
data <- generateImage(as="MSImageSet")
smoothSignal(data, method="gaussian", plot=interactive())

Run the code above in your browser using DataLab