tests/testthat/test-resample-to.R

test_that("resample_to maps methods to interpolation integers", {
  skip_on_cran()
  img <- NeuroVol(array(rnorm(32*32*32), c(32,32,32)), NeuroSpace(c(32,32,32)))
  sp  <- NeuroSpace(c(24,24,24))
  expect_s4_class(resample_to(img, sp, method="nearest"), "NeuroVol")
  expect_s4_class(resample_to(img, sp, method="linear"),  "NeuroVol")
  expect_s4_class(resample_to(img, sp, method="cubic"),   "NeuroVol")
})

test_that("resample_to refuses unknown engine", {
  img <- NeuroVol(array(rnorm(16*16*16), c(16,16,16)), NeuroSpace(c(16,16,16)))
  sp  <- NeuroSpace(c(8,8,8))
  expect_error(resample_to(img, sp, engine="RNiftyReg"), "Only engine = 'internal'")
})

Try the neuroim2 package in your browser

Any scripts or data that you put into this service are public.

neuroim2 documentation built on April 16, 2026, 5:07 p.m.