if (FALSE) {
# Make sure you have N27 brain downloaded to `default_template_directory()`
# threeBrain::download_N27()
n27_dir = file.path(default_template_directory(), "N27")
surf_type = 'pial'
# Locate mesh files
lh = read_fs_asc(file.path(n27_dir, sprintf('surf/lh.%s.asc', surf_type)))
rh = read_fs_asc(file.path(n27_dir, sprintf('surf/rh.%s.asc', surf_type)))
# Create groups
group = create_group(name = sprintf('Surface - %s (N27)', surf_type))
# create mesh
lh_mesh = geom_freemesh(
name = sprintf('FreeSurfer Left Hemisphere - %s (N27)', surf_type),
vertex = lh$vertices[,1:3],
face = lh$faces[,1:3],
group = group
)
rh_mesh = geom_freemesh(
name = sprintf('FreeSurfer Right Hemisphere - %s (N27)', surf_type),
vertex = rh$vertices[,1:3],
face = rh$faces[,1:3],
group = group
)
# Render
if( interactive() ) { threejs_brain(lh_mesh, rh_mesh) }
}
Run the code above in your browser using DataLab