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,
  ...
)

Arguments

image

image to resample

target

image of reference, the output will be in this space

interpType

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

imagetype

choose 0/1/2/3 mapping to scalar/vector/tensor/time-series

verbose

print command and run verbose application of transform.

...

additional arugment passed to antsApplyTransforms C code

Value

output antsImage resampled with target's resolution/origin/orientation/direction

Author

Pustina D

Examples


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))