See ants$resample_image
for more details
Usage
ants_resample_image(
x,
resample_params,
use_voxels = FALSE,
interp_type = c("linear", "nn", "guassian", "sinc", "bspline")
)
Arguments
- x
input image
- resample_params
either relative number or absolute integers
- use_voxels
whether the
resample_params
should be treated as new dimensionuse_voxels=TRUE
, or the new dimension should be calculated based on current dimension andresample_params
combined (use_voxels=FALSE
thenresample_params
will be treated as relative number); default isFALSE
- interp_type
interpolation type; either integer or character; see 'Usage' for available options
Examples
if(interactive() && ants_available()) {
ants <- load_ants()
fi <- as_ANTsImage(ants$get_ants_data("r16"))
# linear (interp_type = 0 or "linear)
filin <- ants_resample_image(fi, c(50, 60), TRUE, "linear")
# nearest neighbor (interp_type = 1 or "nn)
finn <- ants_resample_image(fi, c(50, 60), TRUE, "nn")
par(mfrow = c(1, 3), mar = c(0, 0, 0, 0))
pal <- gray.colors(256, start = 0)
image(fi[], asp = 1, axes = FALSE,
ylim = c(1,0), col = pal)
image(filin[], asp = 1, axes = FALSE,
ylim = c(1,0), col = pal)
image(finn[], asp = 1, axes = FALSE,
ylim = c(1,0), col = pal)
}