View source: R/continuous_refimg.R
refImageContinuous | R Documentation |
refImageContinuous
returns the reference image, calculated using the
method
.
This image represents the basic measure for the filters in SPUTNIK.refImageContinuous
returns the reference image, calculated using the
method
.
This image represents the basic measure for the filters in SPUTNIK.
refImageContinuous(
msiData,
method = "sum",
mzQueryRef = numeric(),
mzTolerance = Inf,
useFullMZRef = TRUE,
doSmooth = FALSE,
smoothSigma = 2,
alignTo = "detected",
invertAligned = FALSE,
verbose = TRUE
)
msiData |
msiDataset object.. |
method |
string (default = "sum"). Method used to calculate the reference image. Valid values are:
|
mzQueryRef |
numeric. Mass-to-charge ratios used to calculate the reference image.
Two values are interpreted as interval, multiple or single values are searched
in the m/z vector. It overrides the |
mzTolerance |
numeric (default = Inf). Search window in parts-per-million units
for the |
useFullMZRef |
logical (default = |
doSmooth |
logical (default = FALSE). If |
smoothSigma |
numeric (default = 2). Standard deviation of the smoothing Gaussian kernel. |
alignTo |
string (default = "detected"). The reference image is aligned to the image representing:
The reference image will have a positive Pearson's correlation with the selected image. |
invertAligned |
logical (default = FALSE). If |
verbose |
logical (default = TRUE). Additional output text. |
Function to extract the continuous reference image from a
msi.dataset-class
object.
The continuous reference image represents the spatial location of the sample.
By default, it is aligned with either the image representing the number of detected
peaks, or the total-ion-count in all pixels. It is expected to be higher in the
region occupied by the sample (positive correlation with the mask representing
the real sample pixels). In some cases, the alignment images can have higher
values in the pixels outside of the sample. In these circumstances, the argument
invertAligned
should be set to TRUE
.
A continuous valued reference image (see msImage).
msiDataset, msImage
## Load package
library("SPUTNIK")
## Mass spectrometry intensity matrix
X <- matrix(rnorm(200), 20, 40)
X[X < 0] <- 0
## Print original dimensions
print(dim(X))
## m/z vector
mzVector <- seq(600, 900, by = (900 - 600) / 39)
## Read the image size
imSize <- c(5, 4)
## Construct the ms.dataset object
msiX <- msiDataset(X, mzVector, imSize[1], imSize[2])
## Calculate the reference and ROI images from the ms.dataset-class object msiX.
## The reference is calculated as the first principal component scores scaled
## in [0, 1]; the binary ROI is calculated applying k-means on the entire dataset.
## Use only m/z values in the range of [700, 900]. The interval extremal values
## are matched within a tolerance of 50 ppm.
refImg <- refImageContinuous(msiX, method = "sum")
roiImg <- refImageBinaryOtsu(refImg)
## Plot the reference and region of interest ROI
## plot(ref.roi$Reference)
## plot(ref.roi$ROI)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.