-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
107 lines (85 loc) · 3 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
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 <img src="man/figures/logo.png" align="right" alt="" width="120" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/ggseg/ggsegSchaefer/workflows/R-CMD-check/badge.svg)](https://github.com/ggseg/ggsegSchaefer/actions)
[![DOI](https://zenodo.org/badge/250276444.svg)](https://zenodo.org/badge/latestdoi/250276444)
[![r-univserse](https://ggseg.r-universe.dev/badges/ggsegSchaefer)](https://ggseg.github.io/ggsegSchaefer/)
<!-- badges: end -->
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](https://ggseg.r-universe.dev/ui#builds):
```{r, eval = FALSE}
# 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](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("LCBC-UiO/ggsegSchaefer")
```
## Example
```{r}
library(ggsegSchaefer)
library(ggseg)
library(ggseg3d)
library(ggplot2)
library(dplyr)
```
```{r, include=FALSE}
dt <- as.data.frame(data(package="ggsegSchaefer")$results, stringsAsFactors = FALSE)
```
### ggseg 2d atlases
```{r, fig.height=20, echo = FALSE}
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
```{r "noneval", eval=FALSE}
ggseg3d(atlas = schaefer7_400_3d, surface = "inflated") %>%
pan_camera("right lateral")
```
```{r "orca", include=FALSE}
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)
```
```{r echo=FALSE, out.width="30%"}
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](CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.