-
Notifications
You must be signed in to change notification settings - Fork 4
/
check_reader.R
61 lines (53 loc) · 1.84 KB
/
check_reader.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
rm(list = ls())
library(gifti)
library(rgl)
library(RColorBrewer)
# file1 = "~/Downloads/BV_GIFTI/GzipBase64/sujet01_Lwhite.surf.gii"
# file2 = "~/Downloads/BV_GIFTI/GzipBase64/sujet01_Lwhite.shape.gii"
file1 = "~/Downloads/100307.L.pial.164k_fs_LR.surf.gii"
# file2 = "~/Downloads/100307.L.atlasroi.164k_fs_LR.shape.gii"
# file2 = "~/Downloads/100307.L.corrThickness.164k_fs_LR.shape.gii"
file2 = "~/Downloads/100307.L.corrThickness.164k_fs_LR.shape.gii"
# file3 = "~/Downloads/BV_GIFTI/GzipBase64/sujet01_Lwhite.inflated.surf.gii"
g = readgii(file1)
gg = readgii(file2)
# g = readgii(file3)
L = g$data
faces = as.vector(t(L$triangle) + 1)
verts = L$pointset[faces,]
# norms = L$normals[faces,]
# cdata = gg$data$cdata[faces,]
cdata = gg$data$normal[faces,]
cols = brewer.pal(7, "Spectral")
mypal = colorRampPalette(colors = cols)
n = 100
# breaks = seq(min(cdata), max(cdata), length.out = n)
# breaks = seq(-1, 1, by = 0.25)
breaks = seq(min(cdata), max(cdata) + 0.25, by = 0.25)
ints = cut(cdata, include.lowest = TRUE, breaks = breaks)
ints = as.integer(ints)
stopifnot(!any(is.na(ints)))
cols = mypal(n)[ints]
cols = scales::alpha(cols, 1)
rgl.open()
rgl.triangles(x = verts, color = cols)
file1 = "~/Downloads/100307.R.pial.164k_fs_LR.surf.gii"
file2 = "~/Downloads/100307.R.corrThickness.164k_fs_LR.shape.gii"
g = readgii(file1)
gg = readgii(file2)
# g = readgii(file3)
L = g$data
faces = as.vector(t(L$triangle) + 1)
verts = L$pointset[faces,]
cdata = gg$data$normal[faces,]
cols = brewer.pal(3, "Spectral")
mypal = colorRampPalette(colors = cols)
n = 10
# breaks = seq(min(cdata), max(cdata), length.out = n)
breaks = seq(min(cdata), max(cdata) + 0.25, by = 0.25)
ints = cut(cdata, include.lowest = TRUE, breaks = breaks)
ints = as.integer(ints)
stopifnot(!any(is.na(ints)))
cols = mypal(n)[ints]
cols = scales::alpha(cols, 1)
rgl.triangles(x = verts, color = cols)