## Instance creation
MSImageData( data = Hashmat(nrow=0, ncol=0), coord = expand.grid( x = seq_len(ncol(data)), y = seq_len(ifelse(ncol(data) > 0, 1, 0))), storageMode = "immutableEnvironment", positionArray = generatePositionArray(coord), dimnames = NULL, ...)
## Additional methods documented belowdata.frame with columns representing the spatial dimensions. Each row provides a spatial coordinate for the location of a feature vector corresponding to a column in data. This argument is ignored if data is a multidimensional array rather than a matrix.MSImageData object for the environment in the data slot. Only "immutableEnvironment" is allowed for MSImageData. See documentation on the storageMode slot below for more details.positionArray for the imaging data. This should not normally be specified the user, since it is generated automatically from the coord argument, unless for some reason coord is not specified.list of length two, giving the feature names and pixel names in that order. If missing, this is taken from the 'dimnames' of the data argument.initialize method for instantiating the object. These must be matrices or matrix-like objects of equal dimension to data. They will be assigned into the environment in the data slot.data:environment which contains at least one element named "iData", and possibly containing an element named "peakData" and "mzData". The "peakData" element contains the intensities of the peak cube in a sparse matrix format. The "mzData" element contians the m/z values of the peaks in a sparse matrix format. All of these matrices have been aligned for that their dimensions reflect only the shared peaks, possibly across multiple datasets. They have been aligned from a call to peakAlign.coord:data.frame with rows giving the spatial coordinates of the pixels corresponding to the columns of "iData".positionArray:array with dimensions equal to the spatial dimensions of the image, which stores the column numbers of the feature vectors corresponding to the pixels in the "iData" element of the data slot. This allows re-construction of the imaging "datacube" on-the-fly.dim:dimnames:list analogous to the 'dimnames' attribute of an ordinary R matrix.storageMode:character which is one of "immutableEnvironment", "lockedEnvironment", or "environment". The values "lockedEnvironment" and "environment" behave as described in the documentation of AssayData. An "immutableEnvironment" uses a locked environment while retaining R's typical copy-on-write behavior. Whenever an object in an immutable environment is modified, a new environment is created for the data slot, and all objects copied into it. This allows usual R functional semantics while avoiding copying of large objects when other slots are modified..__classVersion__:Versions object describing the version of the class used to created the instance. Intended for developer use.VersionedMSImageData instances are usually created through MSImageData().iData(object), iData(object)<-:peakData(object), peakData(object)<-:mzData(object), mzData(object)<-:coord(object), coord(object)<-:data.frame with each row corresponding to the spatial coordinates of a pixel.positionArray(object), positionArray(object)<-:positionArray slot. When setting, this should be an array returned by a call to generatePositionArray.featureNames(object), featureNames(object) <- value:pixelNames(object), pixelNames(object) <- value:storageMode(object), storageMode(object)<-:storageMode slot above for more details.combine(x, y, ...):MSImageData objects. Elements must be matrix-like objects and are combined column-wise with a call to 'cbind'. The numbers of rows must match, but otherwise no checking of row or column names is performed. The pixel coordinates are checked for uniqueness.dim:iData) and the dimensions of the positionArray slot. For a standard imaging dataset, that is the number features followed by the spatial dimensions of the image.dims:data slot. See above for how the dimensions are calculated.MSImageData[i, j, ..., drop]:dim(object). Use drop = NA to return a subset of the same class as the object.ImageData,
SImageData,
SImageSet,
MSImageSet
## Create an MSImageData object
MSImageData()
## Using a P x N matrix
data1 <- matrix(1:27, nrow=3)
coord <- expand.grid(x=1:3, y=1:3)
sdata1 <- MSImageData(data1, coord)
sdata1[] # extract data as array
## Using a P x X x Y array
data2 <- array(1:27, dim=c(3,3,3))
sdata2 <- MSImageData(data2)
sdata2[] # should be identical to above
# Missing data from some pixels
data3 <- matrix(1:9, nrow=3)
sdata3 <- MSImageData(data3, coord[c(1,5,9),])
dim(sdata3) # presents as an array
iData(sdata3) # stored as matrix
sdata3[] # recontruct the datacube
iData(sdata3)[,1] <- 101:103 # assign using iData()
sdata3[] # can only assign into matrix representation
## Sparse feature vectors
data4 <- Hashmat(nrow=9, ncol=9)
sdata4 <- MSImageData(data4, coord)
iData(sdata4)[] <- diag(9)
sdata4[1,,]
Run the code above in your browser using DataLab