iSet
derived class for pixel-sparse imaging data. Data is stored to be memory efficient when there are missing pixels or when the the stored images are non-rectangular regions. The data structures remain efficient for non-sparse pixel data as long as the full datacube does not need to be reconstructed often, and single images or feature vectors are of primary interest. This class can be combined with Hashmat
to be sparse in both feature space and pixel space. This is useful for datasets with sparse signals, such as processed spectra. MSImageSet
is a derived class of SImageSet
for storing mass spectrometry imaging experiments.
## Instance creation
SImageSet( data = Hashmat(nrow=0, ncol=0), coord = expand.grid( x = seq_len(prod(dim(data)[-1])), y = seq_len(ifelse(prod(dim(data)[-1]) > 0, 1, 0))), imageData = SImageData( data=data, coord=coord), pixelData = IAnnotatedDataFrame( data=coord, varMetadata=data.frame(labelType=rep("dim", ncol(coord)))), featureData = AnnotatedDataFrame( data=data.frame(row.names=seq_len(nrow(data)))), protocolData = AnnotatedDataFrame( data=data.frame(row.names=sampleNames(pixelData))), experimentData = new("MIAPE-Imaging"), ...)
## Additional methods documented below
data.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.SImageData
that will contain the imaging data. Usually constructed using data
and coord
.IAnnotatedDataFrame
giving the information about the pixels including coordinates of the data in imageData
.AnnotatedDataFrame
giving information about the data features.AnnotatedDataFrame
giving information about the samples. It must have one row for each of the sampleNames
in pixelData
.MIAxE
giving information about the imaging experiment.imageData
:SImageData
, which stores one or more matrices of equal number of dimensions as elements in an 'immutableEnvironment'. This slot preserves copy-on-write behavior when it is modified specifically, but is pass-by-reference otherwise, for memory efficiency.pixelData
:IAnnotatedDataFrame
. This includes both pixel coordinates and phenotypic and sample data. Its rows correspond to the columns in imageData
.featureData
:IAnnotatedDataFrame
. Its rows correspond to the rows in imageData
.experimentData
:MIAxE
.protocolData
:IAnnotatedDataFrame
describing the generation of the samples in pixelData
..__classVersion__
:Versions
object describing the version of the class used to created the instance. Intended for developer use.iSet
, directly.
VersionedBiobase
, by class "iSet", distance 1.
Versioned
, by class "VersionedBiobase", distance 2.SImageSet
instances are usually created through SImageSet()
.iData(object), iData(object) <- value
:imageData
. This is a matrix-like object with rows corresponding to features and columns corresponding to pixels, so that each column of the returned object is a feature vector.regeneratePositions
:positionArray
in imageData
used to reconstruct the datacube based on the coordinates in pixelData
. Normally, this should not be called by the user. However, if the coordinates are modified manually, it can be used to re-sync the data structures.combine(x, y, ...)
:SImageSet
objects. Unique 'sample's in pixelData
are treated as a dimension.SImageSet[i, j, ..., drop]
:SImageSet
based on the rows (featureData components) and the columns (pixelData components). The result is a new SImageSet
.iSet
for additional methods.iSet
,
SImageData
,
MSImageSet
## Create an SImageSet object
data <- matrix(1:27, nrow=3)
coord <- expand.grid(x=1:3, y=1:3)
sset <- SImageSet(data=data, coord=coord)
## Access a single image corresponding to the first feature
imageData(sset)[1,,]
## Reconstruct the datacube
imageData(sset)[]
## Access the P x N matrix of column-wise feature vectors
iData(sset)
## Subset the SImageSet to the first 2 features and first 6 pixels
sset2 <- sset[1:2, 1:6]
imageData(sset2)[]
sset2
Run the code above in your browser using DataLab