resampleImageToTarget.Rd
Resample image by using another image as target reference. This function uses antsApplyTransform with an identity matrix to achieve proper resampling.
resampleImageToTarget(
image,
target,
interpType = "linear",
imagetype = 0,
verbose = FALSE,
...
)
image to resample
image of reference, the output will be in this space
Choice of interpolator. Supports partial matching.
linear
nearestNeighbor
multiLabel for label images but genericlabel is preferred
gaussian
bSpline
cosineWindowedSinc
welchWindowedSinc
hammingWindowedSinc
lanczosWindowedSinc
genericLabel use this for label images
choose 0/1/2/3 mapping to scalar/vector/tensor/time-series
print command and run verbose application of transform.
additional arugment passed to antsApplyTransforms
C code
output antsImage resampled with target's resolution/origin/orientation/direction
fname <- getANTsRData("r16")
fi <- antsImageRead(fname)
fi2mm <- resampleImage(fi, c(2, 2), useVoxels = 0, interpType = "linear")
resampled <- resampleImageToTarget(fi2mm, fi)
testthat::expect_error(resampleImageToTarget(fi2mm))