Learn R Programming

dcemriS4 (version 0.55)

shift3D: Shift a 3D Array in One Dimension

Description

One axis of the three-dimensional array is translated by an integer amount. This is useful when applying convolution operators in the Fourier domain.

Usage

shift3D(A, s, type, fill = 0)

Arguments

A

is a three-dimensional array.

s

is the integer number of translation steps.

type

is a character string using anatomical coordinates assuming a transverse acquisition scheme (“LR” = left-right = x-axis, “AP” = anterior-posterior = y-axis, “SI” = superior-inferior = z-axis).

fill

is the quantity used to fill gaps induced by the translations (circular boundary conditions are NOT used).

Value

A three-dimensional array is returned, the same dimension as the original array, with one dimension translated.

See Also

convFFT

Examples

Run this code
# NOT RUN {
cube <- array(0, rep(20,3))
cube[9:12,9:12,9:12] <- 1
cube.shift <- shift3D(cube, 5, type="AP")
par(mfrow=c(1,2), mar=rep(0.5,4))
image(cube[,,10], xlab="", ylab="", axes=FALSE)
image(cube.shift[,,10], xlab="", ylab="", axes=FALSE)
# }

Run the code above in your browser using DataLab