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

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

Avants BB

Examples

fi <- antsImageRead(getANTsRData("r16"))
r <- range(fi)
finn <- resampleImage(fi, c(50, 60), TRUE, 0)
range(finn)
#> [1]   0.00 247.96
stopifnot(diff(range(finn)) > 0)
filin <- resampleImage(fi, c(1.5, 1.5), FALSE, 1)
range(filin)
#> [1]   0 254
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)