knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.width = 6,
  fig.retina = 3,
  out.width = "100%"
)
Sys.setenv(PATH = paste("/opt/miniconda3/bin", Sys.getenv("PATH"),sep=":"))

ggsegSchaefer

R-CMD-check DOI r-univserse

This package contains dataset for plotting the Schaefer cortical atlas (version 0.17.1) ggseg and ggseg3d. Now includes sets for the 17 and 7 network atlas, for parcellations 100:1000.

Installation

The best experience installing ggsegSchaefer is through the ggseg r-universe:

# Enable this universe
options(repos = c(
    ggseg = 'https://ggseg.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))

# Install some packages
install.packages('ggsegSchaefer')

You can install the released version of ggsegSchaefer from GitHub with:

# install.packages("remotes")
remotes::install_github("LCBC-UiO/ggsegSchaefer")

Example

library(ggsegSchaefer)
library(ggseg)
library(ggseg3d)
library(ggplot2)
library(dplyr)
dt <- as.data.frame(data(package="ggsegSchaefer")$results, stringsAsFactors = FALSE)

ggseg 2d atlases

library(patchwork)
gg <- dt %>% 
  filter(!grepl("_3d$", Item)) %>% 
  pull(Item) %>% 
  lapply(function(x) plot(get(x), show.legend = FALSE) + ggtitle(x))
wrap_plots(gg, ncol = 1) &
  theme_brain2()

ggseg 3d atlases

ggseg3d(atlas = schaefer7_400_3d, surface = "inflated") %>% 
  pan_camera("right lateral")
save3d <- function(data){
  p <- ggseg3d(atlas = data, surface = "inflated") %>%
    pan_camera("right lateral") %>%
    plotly::add_annotations( text=sprintf("%s\nScreen capture", data),
                    legendtitle=TRUE, showarrow=FALSE,
                    font = list(color = "#000000b4",
                                family = 'sans serif',
                                size = 50))
  plotly::orca(p, sprintf("man/figures/README-%s-plot.png", data))
}
dt %>% 
  filter(grepl("_3d$", Item)) %>% 
  pull(Item) %>% 
  lapply(save3d)
knitr::include_graphics(list.files("man/figures/", "schaefer", full.names = TRUE))

Please note that the 'ggsegSchaefer' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



LCBC-UiO/ggsegSchaefer documentation built on March 31, 2022, 6:39 p.m.