Title: | Tri-Surface Mesh Plots for Brain Atlases |
---|---|
Description: | Mainly contains a plotting function ggseg3d(), and data of two standard brain atlases (Desikan-Killiany and aseg). By far, the largest bit of the package is the data for each of the atlases. The functions and data enable users to plot tri-surface mesh plots of brain atlases, and customise these by projecting colours onto the brain segments based on values in their own data sets. Functions are wrappers for 'plotly'. Mowinckel & Vidal-Piñeiro (2020) <doi:10.1177/2515245920928009>. |
Authors: | Athanasia Mo Mowinckel [aut, cre] , Didac Vidal-Piñeiro [aut] |
Maintainer: | Athanasia Mo Mowinckel <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.6.3 |
Built: | 2024-11-17 05:11:58 UTC |
Source: | https://github.com/ggseg/ggseg3d |
Adds a translucent brain on top of a ggseg3d plot to create a point of reference, particularly important for sub-cortical plots.
add_glassbrain( p, hemisphere = c("left", "right"), colour = "#cecece", opacity = 0.3 )
add_glassbrain( p, hemisphere = c("left", "right"), colour = "#cecece", opacity = 0.3 )
p |
plotly object |
hemisphere |
string. hemisphere to plot ("left" or "right") |
colour |
string. colour to give the glass brain |
opacity |
numeric. transparency of the glass brain (0-1 float) |
plotly object with glass brain tri-surface mesh
library(dplyr) ggseg3d(atlas="aseg_3d") %>% add_glassbrain("left")
library(dplyr) ggseg3d(atlas="aseg_3d") %>% add_glassbrain("left")
Coordinate data for the subcortical parcellations implemented in FreeSurfer.
data(aseg_3d)
data(aseg_3d)
A tibble with 4 observations and a nested data.frame
type of surface ('inflated' or 'white')
hemisphere ('left“ or 'right')
data.frame of necessary variables for plotting
String. atlas name
numbered region from surface
concatenated region name
label 'hemi_annot' of the region
list of meshes in two lists: vb and it
name of region in full
HEX colour of region
Fischl et al., (2002). Neuron, 33:341-355 (PubMed)
Other ggseg3d_atlases:
dk_3d
data(aseg_3d)
data(aseg_3d)
Mesh data for the Desikan-Killiany Cortical atlas, with 40 regions in on the cortical surface of the brain.
data(dk_3d)
data(dk_3d)
A tibble with 4 observations and a nested data.frame
type of surface ('inflated' or 'white')
hemisphere ('left“ or 'right')
data.frame of necessary variables for plotting
String. atlas name
numbered region from surface
concatenated region name
label 'hemi_annot' of the region
list of meshes in two lists: vb and it
abbreviated name of annot
lobe localization
name of region in full
HEX colour of region
A nested tibble for all available surfaces and hemispheres
Fischl et al. (2004) Cerebral Cortex 14:11-22 (PubMed)
Other ggseg3d_atlases:
aseg_3d
data(dk_3d)
data(dk_3d)
The 'ggseg_3datlas' class is a subclass of ['data.frame'][base::data.frame()], created in order to have different default behaviour. It heavily relies on the "tibble" ['tbl_df'][tibble::tibble()]. [tidyverse](https://www.tidyverse.org/packages/), including [dplyr](http://dplyr.tidyverse.org/), [ggplot2](http://ggplot2.tidyverse.org/), [tidyr](http://tidyr.tidyverse.org/), and [readr](http://readr.tidyverse.org/).
as_ggseg3d_atlas(x, return = FALSE)
as_ggseg3d_atlas(x, return = FALSE)
x |
data.frame to be made a ggseg-atlas |
return |
return logical |
an object of class 'ggseg3d_atlas'. A nested tibble of different brain surface shapes, hemispheres and tri-surface mesh information for different brain regions in a specific atlas.
Objects of class 'ggseg3d_atlas' have: * A 'class' attribute of 'c("ggseg3d_atlas", "tbl_df", "tbl", "data.frame")'. * A base type of '"list"', where each element of the list has the same [NROW()]. * A lot of this script and its functions are taken from the ['tibble'][tibble::tibble()]-package
[tibble()], [as_tibble()], [tribble()], [print.tbl()], [glimpse()]
tmp <- as.data.frame(dk_3d) class(tmp) new_atlas <- as_ggseg3d_atlas(tmp) class(new_atlas)
tmp <- as.data.frame(dk_3d) class(tmp) new_atlas <- as_ggseg3d_atlas(tmp) class(new_atlas)
Check if is ggseg_atlas-class
is_ggseg3d_atlas(x)
is_ggseg3d_atlas(x)
x |
atlas object to check |
logical
The default position for plotly mesh plots are not satisfying for brain plots. This convenience function can pan the camera to lateral or medial view, or to custom made views if you are plotly savvy.
pan_camera(p, camera, aspectratio = 1)
pan_camera(p, camera, aspectratio = 1)
p |
plotly object |
camera |
string or list. |
aspectratio |
camera aspect ratio |
plotly object
library(dplyr) ggseg3d() %>% pan_camera("right lateral")
library(dplyr) ggseg3d() %>% pan_camera("right lateral")
When publishing data visualisation in 3d mesh plots in general the axes are not important, at least they are not for ggseg3d, where the axis values are arbitrary.
remove_axes(p)
remove_axes(p)
p |
plotly object |
plotly object without axes
library(magrittr) ggseg3d() %>% remove_axes()
library(magrittr) ggseg3d() %>% remove_axes()