rescale.abi: Rescale Allen data

View source: R/array_reshaping.R

rescale.abiR Documentation

Rescale Allen data

Description

Rescale Allen data

Usage

rescale.abi(img, factor, interpolation = "cubic")

Arguments

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.

Value

resampled image

Examples



# 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)

DJFernandes/ABIgeneRMINC documentation built on March 21, 2022, 12:05 p.m.