# up-sample and rotate image
x <- array(0, c(9, 9, 9))
x[4:6, 4:6, 4:6] <- 1
vox2ras <- matrix(nrow = 4, byrow = TRUE, c(
0.7071, -0.7071, 0, 0,
0.7071, 0.7071, 0, -5.5,
0, 0, 1, -4,
0, 0, 0, 1
))
new_vox2ras <- matrix(nrow = 4, byrow = TRUE, c(
0, 0.5, 0, -4,
0, 0, -0.5, 4,
0.5, 0, 0, -4,
0, 0, 0, 1
))
y <- resample_3d_volume(
x,
c(17, 17, 17),
vox2ras_old = vox2ras,
vox2ras_new = new_vox2ras,
na_fill = 0
)
image(y[9,,])
Run the code above in your browser using DataLab