resampleImage: resampleImage

View source: R/resampleImage.R

resampleImageR Documentation

resampleImage

Description

Resample image by spacing or number of voxels with various interpolators. Works with multi-channel images.

Usage

resampleImage(
  image,
  resampleParams,
  useVoxels = FALSE,
  interpType = "nearestneighbor"
)

Arguments

image

input antsImage

resampleParams

vector of size dimension with numeric values

useVoxels

true means interpret resample params as voxel counts

interpType

one of 0 (linear), 1 (nearestNeighbor), 2 (gaussian), 3 (windowedSinc), 4 (bspline). The user can pass either a numeric or character argument here.

Value

output antsImage

Author(s)

Avants BB

Examples

fi <- antsImageRead(getANTsRData("r16"))
r <- range(fi)
finn <- resampleImage(fi, c(50, 60), TRUE, 0)
range(finn)
stopifnot(diff(range(finn)) > 0)
filin <- resampleImage(fi, c(1.5, 1.5), FALSE, 1)
range(filin)
stopifnot(diff(range(filin)) > 0)
pixeltype(fi) <- "float"
arr <- as.array(fi)
arr <- floor(arr)
class(arr) <- "integer"
fi <- as.antsImage(arr, pixeltype = "unsigned int")
filin <- resampleImage(fi, c(1.5, 1.5), FALSE, 1)
fi <- as.antsImage(arr > 14, pixeltype = "unsigned char")
filin <- resampleImage(fi, c(1.5, 1.5), FALSE, 1)

fi <- antsImageRead(getANTsRData("multi_component_image"))
filin <- resampleImage(fi, c(2, 2), FALSE, 1)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.