if (is_not_cran()) {
data("left_hippocampus_mask")
mesh <- vcg_isosurface(left_hippocampus_mask)
# Fix defects
mesh <- vcg_fix_defects(mesh, verbose = TRUE)
# Center the mesh
mesh$vb[1:3, ] <- mesh$vb[1:3, ] - rowMeans(mesh$vb[1:3, ])
# Inflate the surface while keeping the node distances
result <- mris_inflate(mesh, n_averages = 4L, niterations = 5L,
scale_brain = FALSE, verbose = TRUE)
# Visualize with the sulcal values
pal <- colorRampPalette(c("black", "gray", "red"))(128)
col <- pal[pmax(pmin(round(result$sulc * 10 + 64), 128), 1)]
oldpar <- par(mfrow = c(1, 2))
on.exit({ par(oldpar) })
plot(
mesh, col = col,
eye = c(0, 100, 0),
up = c(1, 0, 0))
plot(
result$mesh, col = col,
eye = c(0, 100, 0),
up = c(1, 0, 0))
}
Run the code above in your browser using DataLab