antsImagePhysicalSpaceConsistency.Rd
Check if two antsImage
objects occupy the same physical space
antsImagePhysicalSpaceConsistency(img1, img2, coordinate.tolerance = 0.01, direction.tolerance = 0.01, data.type = FALSE)
img1 | Image object of S4 class |
---|---|
img2 | Image object of S4 class |
coordinate.tolerance | floating point error tolerance in origin |
direction.tolerance | floating point error tolerance in direction matrix |
data.type | boolean, if TRUE check pixeltype and components, default is FALSE |
Boolean indicating consistency of physical space
img1 <- makeImage(c(10,10), rnorm(100)) img2 <- makeImage(c(10,10), rnorm(100)) check <- antsImagePhysicalSpaceConsistency(img1, img2) check <- antsImagePhysicalSpaceConsistency(img1, img2, data.type = TRUE) testthat::expect_error( antsImagePhysicalSpaceConsistency(img1, as.array(img2)) ) i2 = img2 pixeltype(i2) = "unsigned int" testthat::expect_false( antsImagePhysicalSpaceConsistency(img1, i2, data.type = TRUE) ) i2 = mergeChannels(list(img2, img2)) testthat::expect_false( antsImagePhysicalSpaceConsistency(img1, i2, data.type = TRUE) ) i2 = as.antsImage(img2[1:5, 1:5], reference = img2) testthat::expect_false( antsImagePhysicalSpaceConsistency(img1, i2) ) i2 = img2 antsSetSpacing(i2, c(0.5, 0.5))#> [1] 0testthat::expect_false( antsImagePhysicalSpaceConsistency(img1, i2) ) i2 = img2 antsSetOrigin(i2, c(1, 2))#> [1] 0testthat::expect_false( antsImagePhysicalSpaceConsistency(img1, i2) ) i2 = img2 antsSetDirection(i2, -1*antsGetDirection(i2))#> [1] 0