tests/testthat/test-roivolume.R

test_that("can create a RegionSphere", {
  sp1 <- BrainSpace(c(10,10,10), c(1,1,1))
  sphere <- RegionSphere(sp1, c(5,5,5), 3)
  expect_that(sphere, is_a("ROIVolume"))
})

test_that("can create a RegionCube", {
  sp1 <- BrainSpace(c(10,10,10), c(1,1,1))
  cube <- RegionCube(sp1, c(5,5,5), 3)
  expect_that(cube, is_a("ROIVolume"))
})

test_that("can convert region coordinates to indices", {
  sp1 <- BrainSpace(c(10,10,10), c(1,1,1))
  cube <- RegionCube(sp1, c(5,5,5), 3)
  idx <- gridToIndex(space(cube), coords(cube))
  vox <- indexToGrid(space(cube), idx)
  expect_equivalent(vox, coords(cube))
})

Try the neuroim package in your browser

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

neuroim documentation built on May 2, 2019, 1:04 p.m.