reduceBaseline-methods {Cardinal} | R Documentation

## Reduce the baseline for an imaging dataset

### Description

Apply baseline reduction to the feature vectors of an imaging dataset.

### Usage

    ## S4 method for signature 'SparseImagingExperiment'
    reduceBaseline(object, method = c("locmin", "median"), ...)

    ## S4 method for signature 'MSImageSet'
    reduceBaseline(object, method = "median",
        ...,
        pixel = pixels(object),
        plot = FALSE)

    ## Local minima baseline reduction
    reduceBaseline.locmin(x, window=5, ...)

    ## Interpolated median baseline reduction
    reduceBaseline.median(x, blocks=500, fun=median, spar=1, ...)

### Arguments

`object` | An imaging dataset.
`method` | The baseline reduction method to use.
`pixel` | The pixels to baseline subtract. 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 baseline reduction method.
`x` | The signal to be baseline-corrected.
`blocks` | The number of intervals to break the mass spectrum into in order to choose minima or medians from which to interpolate the baseline.
`fun` | Function used to determine the points from which the baseline will be interpolated.
`spar` | Smoothing parameter for the spline smoothing applied to the spectrum in order to decide the cutoffs for throwing away baseline references that might occur inside peaks.
`window` | The sliding window (number of data points) to consider when determining the local minima.

### Details

Baseline reduction 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. with the baseline-subtracted intensities.

Internally, `pixelApply` is used to apply the baseline reduction. See its documentation page for more details on additional objects available to the environment installed to the baseline reduction function.

### Value

An object of the same class with the baseline-subtracted spectra.

### Author(s)

Kylie A. Bemis

### See Also

`MSImagingExperiment`, `MSImageSet`, `pixelApply`, `process`

### Examples

    setCardinalBPPARAM(SerialParam())

    set.seed(2)
    data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), baseline=1)
    data <- data[,pData(data)$circle]

    # queue baseline reduction
    data <- reduceBaseline(data, method="median", blocks=100)

    # apply baseline reduction
    data_nobaseline <- process(data, plot=interactive())

[Package Cardinal version 2.8.0 Index]