-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_fs_annot.jl
36 lines (24 loc) · 1.33 KB
/
test_fs_annot.jl
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
# Tests for reading FreeSurfer annotation data.
@testset "Read a FreeSurfer annotation and compute properties" begin
ANNOT_FILE = joinpath(Base.source_dir(), "data/subjects_dir/subject1/label/lh.aparc.annot")
fs_annot = read_annot(ANNOT_FILE)
@test Base.length(fs_annot.vertex_indices) == 149244
@test Base.length(fs_annot.vertex_labels) == 149244
@test typeof(fs_annot.colortable) == NeuroFormats.FreeSurfer.ColorTable
@test fs_annot.colortable.name[1] == "unknown"
@test fs_annot.colortable.name[2] == "bankssts"
@test fs_annot.colortable.r[1] == 25
@test fs_annot.colortable.g[1] == 5
@test fs_annot.colortable.b[1] == 25
@test fs_annot.colortable.a[1] == 0
@test fs_annot.colortable.label[1] == 1639705
@test Base.length(regions(fs_annot)) == 36
@test Base.length(region_vertices(fs_annot, "bankssts")) == 1722
@test Base.length(vertex_regions(fs_annot)) == 149244
@test label_from_rgb(fs_annot.colortable.r[1], fs_annot.colortable.g[1], fs_annot.colortable.b[1]) == fs_annot.colortable.label[1]
end
@testset "Derive per-vertex color information from a FreeSurfer annotation" begin
ANNOT_FILE = joinpath(Base.source_dir(), "data/subjects_dir/subject1/label/lh.aparc.annot")
fs_annot = read_annot(ANNOT_FILE)
@test Base.length(vertex_colors(fs_annot)) == 149244
end