Description Usage Arguments Details Value Author(s) See Also Examples
Apply smoothing to the feature vectors of an imaging dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S4 method for signature 'SparseImagingExperiment'
smooth(x, ...)
## S4 method for signature 'SparseImagingExperiment'
smoothSignal(object, method = c("gaussian", "sgolay", "ma"), ...)
## S4 method for signature '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, ...)
|
object |
An imaging dataset. |
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 each pixel while it is being processed? |
... |
Additional arguments passed to the smoothing method. |
x |
The signal or dataset 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. |
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
: A numeric
vector of intensities.
...
: Additional arguments.
A user-created function should return a numeric
vector of the same length.
Internally, pixelApply
is used to apply the smooothing. See its documentation page for more details on additional objects available to the environment installed to the smoothing function.
An object of the same class with the smoothed spectra.
Kylie A. Bemis
MSImagingExperiment
,
MSImageSet
,
pixelApply
,
process
1 2 3 4 5 6 7 8 9 10 11 | setCardinalBPPARAM(SerialParam())
set.seed(2)
data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), baseline=1)
data <- data[,pData(data)$circle]
# queue smoothing
data <- smoothSignal(data, method="ma", window=9)
# apply smoothing
data_smooth <- process(data, plot=interactive())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.