ciftiTools (version 0.1.6.0)

rgl_interactive_plots_Description: Navigating and Embedding the Interactive Plots

Description

Navigating and Embedding the Interactive Plots

Arguments

Navigating and Embedding the Interactive Plots

This function opens an interactive Open GL window rendered by rgl. If save==TRUE and close_after_save==TRUE, the window will be closed after the function call. Otherwise, it is kept open and the following information applies:

To navigate the plot, left click and drag the cursor to rotate. Use the scroll wheel or right click and drag to zoom. Press the scroll wheel and drag to change the field-of-view. Execute snapshot to save the current window as a .png file. Execute rgl.close to close the window. rgl.viewpoint can be used for programmatic navigation.

The Open GL window can be embedded as an htmlwidget in an R Markdown document using one of two methods. The first is executing rglwidget in the chunk where the plot is made. This first method should work within both the RStudio IDE and a knitted .html file. The second method is executing setupKnitr at the start of the document and then using the chunk option webgl=TRUE in the chunk where the plot is made. The second method is specifically for knitted .html files. Although the first method is the newest approach and is recommended by others, we used the second method in the ciftiTools vignette because the first is not compatible with htmlpreview. For both methods, the window still needs to be open to render the widget. Also for both methods, you will probably need to tweak the image dimensions e.g. fig.width=8, fig.height=5 in the chunk options, because it uses the defaults from RMarkdown/Knitr instead of what makes sense based on the dimensions of the Open GL window.

For view_xifti_surface, if length(idx) > 1, this function will automaticaly return an htmlwidget using the first method, but with a playwidget wrapper to add a slider to control which column index is being displayed. All the meshes will be rendered on top of one another in the Open GL window, so only the widget will be useful for viewing the data interactively. Since it uses the first method, it will not be visible with htmlpreview. No additional call to rglwidget is necessary, but rgl.close must be called in a following chunk to close the Open GL window.