Learn R Programming

tofsims (version 1.0.2)

bwApply: bwApply

Description

bwApply allow to get new object from a black / white matrix All NZs at black positions will be taken

Usage

bwApply(object, bwMatrix)

## S3 method for class 'MassSpectra,matrix': bwApply(object, bwMatrix)

Arguments

object
object of class MassImage
bwMatrix
matrix with boolean or numeric 1 and 0

Value

  • object of class MassImage multiplied with B/W matrix

Examples

Run this code
library(tofsimsData)
data(tofsimsData)
testImage <- PCAnalysis(testImage, nComp = 2)
library(EBImage)
mask<-thresh(imageMatrix(analysis(testImage,noAccess = 1),comp = 1), w = 15, h = 15)
#inverse of mask
mask <- (mask-1)^2
par(mfcol=c(1,2), oma=c(0,0,0,0), mar=c(0,0,0,0))
image(testImage)
image(bwApply(testImage, mask))

Run the code above in your browser using DataLab