Last active
August 27, 2021 15:21
-
-
Save dfsp-spirit/1fc3272b5f4549116721a9b92a7ec847 to your computer and use it in GitHub Desktop.
Register a post-render-hook in fsbrain >= 0.5.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(fsbrain) | |
# We use thickness on fsaverage as demo data | |
sjd = fsaverage.path(); | |
sj = "fsaverage"; | |
# Visualize once with standard settings: | |
vis.subject.morph.native(sjd, sj, "thickness"); | |
# Register a post-render callback function that can do whatever you want: | |
post_render_hook = function(x){ rgl::light3d(diffuse="#333333"); message(sprintf("Adding more light to view '%s'.\n", x)); } | |
options('fsbrain.callback_hook_after_render' = post_render_hook); | |
# Visualize again. After rendering of each tile/rgl scene, the post_render_hook gets called. | |
# The scene is now brighter: | |
vis.subject.morph.native(sjd, sj, "thickness"); | |
# You can reset to defaults if you do not want the hook anymore: | |
options('fsbrain.callback_hook_after_render' = NULL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment