reduceDimension-methods {Cardinal} | R Documentation

## Reduce the Dimension of an Imaging Dataset

### Description

Apply dimension reduction to a mass spectrometry imaging dataset.

### Usage

    ## S4 method for signature 'MSImageSet,missing'
    reduceDimension(object, method = c("bin", "resample"),
        ...,
        pixel = pixels(object),
        plot = FALSE)

    ## S4 method for signature 'MSImageSet,numeric'
    reduceDimension(object, ref, method = "peaks", ...)

    ## S4 method for signature 'MSImageSet,MSImageSet'
    reduceDimension(object, ref, method = "peaks", ...)

    ## Bin the signal
    reduceDimension.bin(x, t, width=200, offset=0, units=c("ppm","mz"), fun=sum, ...)

    ## Resample the signal
    reduceDimension.resample(x, t, step=1, offset=0, ...)

    ## Reduce the signal to peaks
    reduceDimension.peaks(x, t, peaklist, type=c("height", "area"), ...)

### Arguments

`object` | An object of class `MSImageSet`.
`ref` | A reference to use to reduce the dimension, usually a peak list of m/z values or a peak-picked and aligned `MSImageSet`.
`method` | The method to use to reduce the dimensions of the signal.
`pixel` | The pixels to process. 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 dimension reduction method.
`x` | The mass spectrum to be reduced.
`t` | The corresponding m/z values.
`width` | The width of a bin.
`step` | The step size.
`offset` | Offset from the nearest integer.
`units` | Either parts-per-million or the raw m/z values.
`fun` | The function to be applied to each bin.
`peaklist` | A `numeric` vector giving the m/z values of the reference peaks.
`type` | Should the peak height or area under the curve be taken as the intensity value?

### Details

Dimension 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.

- `t`: A `numeric` vector of m/z values.

- `tout`: A `numeric` vector of m/z values to output.

- `...`: Additional arguments.

The optional argument `tout` was added in version 1.3.1 to avoid cases where the output m/z values may be costly and inefficient to re-calculate for every spectrum.

A user-created function should return a `list` with two vectors of equal length, where the new length must be shorter than `x` and `t`:

- `x`: A `numeric` vector of new intensities.

- `t`: A `numeric` vector of new m/z values.

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

### Value

An object of class `MSImageSet` with the dimension-reduced spectra.

### Author(s)

Kylie A. Bemis

### See Also

`MSImageSet`, `peakPick`, `peakAlign`, `pixelApply`

### Examples

    data <- generateImage(as="MSImageSet")
    reduceDimension(data, method="resample", step=100, plot=interactive())

[Package Cardinal version 1.12.1 Index]