Working with CIFTI Files
John Muschelli
2018-02-01
Warning in read_cifti(file): Dimensions of the data > 2, so no transposing
done!
Warning in read_cifti(file): Dimensions of the data > 2, so no transposing
done!
right_surf = surf_triangles(right_gii)
all_vals = rbind(as.matrix(left$values), as.matrix(right$values))
vals = all_vals[,1]
ncol = 99
breaks = seq(
min(vals, na.rm = TRUE),
max(vals, na.rm = TRUE),
len = ncol + 1)
ii <- cut(left$values,
breaks,
include.lowest = TRUE)
## Use bin indices, ii, to select color from vector of
# n-1 equally spaced colors
# ramp_cols = brewer.pal(11, "Spectral")
# ramp_cols = hotmetal()
# ramp_cols = c("red", "blue")
# ramp_cols = gray(0:64/64)
# ramp_cols = c("white", "black")
ramp_cols = c("black", "white")
colors <- colorRampPalette(
ramp_cols
)(ncol)[ii]
rgl.triangles(left_surf$pointset, color = colors)
ii <- cut(right$values,
breaks,
include.lowest = TRUE)
## Use bin indices, ii, to select color from vector of
# n-1 equally spaced colors
# colors <- colorRampPalette(
# c("red", "blue"))(ncol)[ii]
rgl.triangles(right_surf$pointset, color = colors)
# rgl.close()
rgl.open()
rgl.triangles(left_surf$pointset, color = colors)
left_mid = colMeans(left_surf$pointset)
left_ranges = colRanges(left_surf$pointset)
size_left = rowDiffs(left_ranges)
left_text = left_mid
left_text[3] = left_ranges[3,2] + size_left[3]/4
rgl.texts(x = left_text, text = "Left")
right_mid = colMeans(right_surf$pointset)
right_surf$pointset[,2] = right_surf$pointset[,2] + size_left[2] * 1.25
right_surf$pointset[,1] = -1 * right_surf$pointset[,1]
right_surf$pointset[,2] = -1 * right_surf$pointset[,2]
right_mid = colMeans(right_surf$pointset)
right_text = right_mid
right_text[3] = left_text[3]
rgl.triangles(right_surf$pointset, color = colors)
rgl.texts(x = right_text, text = "Right")
rgl.viewpoint(0, -70)
play3d(spin3d(), duration = 3)