data(volcano)
d <- list(x = seq(-10, 10, length = nrow(volcano)),
y = seq(-5, 5, length = ncol(volcano)),
z = array(0L, c(nrow(volcano), ncol(volcano), 2)) )
mv <- min(volcano)
for (i in 0:61) {
blk <- (i %/% 31) + 1
bit <- (i - 1) %% 31
bits(d$z[,,blk], bit) <- volcano > (mv + i*1.6 )
}
for (i in 0:61) image(get.mask(d, i))
## an object with 62 masks is only twice the size of the source data
object.size(d) / object.size(volcano)
## plot a smaller version
image(get.mask(d, 20), 5)
Run the code above in your browser using DataLab