View source: R/array_reshaping.R
| rescale.abi | R Documentation |
Rescale Allen data
rescale.abi(img, factor, interpolation = "cubic")
img |
Image you want to resample (either a 1D vector or array) |
factor |
How much down/up-sampling. Less than 1 to downsample, greater than 1 to upsample. |
resampled image
# download the Allen Brain Institute p56 nissl atlas
p56vec = read.raw.atlas('http://download.alleninstitute.org/informatics-archive/current-release/mouse_annotation/P56_atlasVolume.zip', url=T)
# convert to a volume
p56vol = array(p56vec, dim = attr(p56vec,'ANTsRparam')$imagesize)
# Native file is 25 microns isotropic. Downsample to 100 microns isotropic
p56vol.ds = rescale.abi(p56vol,0.25)
# plot
dev.new(width=9,height=9)
RMINC::mincImage(p56vol, dimension = 2, slice=200, low=0, high=0.5, underTransparent = FALSE, col = colorRampPalette(c('black','white'))(100) )
title('Native Resolution', font.main=2)
dev.new(width=9,height=9)
RMINC::mincImage(p56vol.ds, dimension = 2, slice=50, low=0, high=0.5, underTransparent = FALSE, col = colorRampPalette(c('black','white'))(100) )
title('4x Downsampled', font.main=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.