subVector {neuroim} | R Documentation |
Generic function to extract a sub-vector from a BrainVector
object.
Description
Generic function to extract a sub-vector from a BrainVector
object.
Usage
subVector(x, i, ...)
## S4 method for signature 'SparseBrainVector,numeric'
subVector(x, i)
## S4 method for signature 'DenseBrainVector,numeric'
subVector(x, i)
Arguments
x |
four-dimensional image |
i |
the indices of the volume(s) to extract |
... |
additional arguments |
Value
a BrainVector
object that is a sub-vector of the supplied object.
Examples
bvec <- BrainVector(array(rnorm(24*24*24*24), c(24,24,24,24)), BrainSpace(c(24,24,24,24), c(1,1,1)))
vec <- subVector(bvec,1:2)
all.equal(2, dim(vec)[4])
vec <- subVector(bvec, c(1,3,5,7))
all.equal(4, dim(vec)[4])
mask <- LogicalBrainVolume(rep(TRUE, 24*24*24), BrainSpace(c(24,24,24), c(1,1,1)))
svec <- SparseBrainVector(array(rnorm(24*24*24*24), c(24,24,24,24)),
BrainSpace(c(24,24,24,24), c(1,1,1)), mask)
vec <- subVector(svec, c(1,3,5))
all.equal(3, dim(vec)[4])
[Package neuroim version 0.0.6 Index]