generateImage {Cardinal}R Documentation

Generate a simulated image

Description

Generates a simulated image of spectral signals.

Usage

generateImage(data = factor(1),
    coord = expand.grid(
        x = 1:max(1, nrow(data)),
        y = 1:max(1, ncol(data))),
    peaks = length(levels(as.factor(data))),
    delta = 10,
    as = c("SImageSet", "MSImageSet"),
    ...)

Arguments

data

Either a factor or an integer matrix. If a factor is used, the coord argument should be specified with data to indicate the arrangement of regions in the image. If a matrix is given, coord should not be specified. The image will automatically be generated with different regions corresponding to unique integers in the matrix.

coord

A data.frame with columns representing the spatial dimensions. Each row provides a spatial coordinate for the location of an element of data if data is a factor.

peaks

The number of peaks in the signal.

delta

The effect size of the difference between peaks differentiating different regions in the image (as specified by data).

as

Should the output object be an SImageSet or MSImageSet?

...

Additional arguments to pass to generateSpectrum.

Value

An SImageSet or an MSImageSet.

Author(s)

Kylie A. Bemis

See Also

generateSpectrum

Examples

data <- matrix(c(NA, NA, 1, 1, NA, NA, NA, NA, NA, NA, 1, 1, NA, NA, 
 NA, NA, NA, NA, NA, 0, 1, 1, NA, NA, NA, NA, NA, 1, 0, 0, 1, 
 1, NA, NA, NA, NA, NA, 0, 1, 1, 1, 1, NA, NA, NA, NA, 0, 1, 1, 
 1, 1, 1, NA, NA, NA, NA, 1, 1, 1, 1, 1, 1, 1, NA, NA, NA, 1, 
 1, NA, NA, NA, NA, NA, NA, 1, 1, NA, NA, NA, NA, NA), nrow=9, ncol=9)

set.seed(1)
x <- generateImage(data)

plot(x, pixel=1)
image(x, feature=1)

coord <- expand.grid(x=1:nrow(data), y=1:ncol(data))

data2 <- as.factor(data[is.finite(data)])
coord2 <- coord[is.finite(data),]

set.seed(1)
x2 <- generateImage(data=data, coord=coord, as="MSImageSet")

plot(x, pixel=1)
image(x2, feature=1)

[Package Cardinal version 2.0.4 Index]