From 0dfb05318510d25e70b1b9abc79dc0620d7c578a Mon Sep 17 00:00:00 2001 From: dipterix Date: Fri, 3 May 2024 14:19:44 -0400 Subject: [PATCH] Fixing `readme` and vignettes --- README.md | 8 ++++---- vignettes/A-getting-started.Rmd | 10 +++++----- vignettes/B-data-visualization.Rmd | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b953e96b..149f9822 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ default_template_directory() **N27** template folder resides inside of this directory. -Let's view this subject using the `freesurfer_brain2` function. +Let's view this subject using the `threeBrain` function. 1. Import subject ```r @@ -76,8 +76,8 @@ library(threeBrain) n27_path <- file.path(default_template_directory(), "N27") -x <- freesurfer_brain2( fs_subject_folder = n27_path, - subject_name = 'N27', surface_types = 'pial') +x <- threeBrain( path = n27_path, + subject_code = 'N27', surface_types = 'pial') ``` 2. Visualize ```r @@ -86,7 +86,7 @@ plot(x) # alternatively, you can use x$plot()` ## C. Subject Setup -The sample subject (`N27`) is a sample generated by `FreeSurfer` ([download](https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall)). If you have any subjects processed by `FreeSurfer`, use function `freesurfer_brain2` to visualize. +The sample subject (`N27`) is a sample generated by `FreeSurfer` ([download](https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall)). If you have any subjects processed by `FreeSurfer`, use function `threeBrain` to visualize. ## D. Add/Render Electrodes diff --git a/vignettes/A-getting-started.Rmd b/vignettes/A-getting-started.Rmd index efd68964..c1af58f4 100644 --- a/vignettes/A-getting-started.Rmd +++ b/vignettes/A-getting-started.Rmd @@ -41,11 +41,11 @@ In the following context, I will use `~/Downloads/N27` as an example ## Generate Viewer Object -```{r setup} +```{r setup, eval=FALSE} library(threeBrain) subject_code <- "N27" subject_path <- "~/Downloads/N27" -brain <- freesurfer_brain2(subject_path, subject_code) +brain <- threeBrain(subject_path, subject_code) print(brain) #> Subject - N27 #> Transforms: @@ -93,7 +93,7 @@ If this is the first time, it might take a while to import and generate cache fi Visualizing the viewer is simply just one line. -```{r} +```{r, eval=FALSE} brain$plot() ``` @@ -126,8 +126,8 @@ The atlas type can be selected from `aparc+aseg`, `aparc.a2009s+aseg`, `aparc.DK The following example loads `pial` and `smoothwm`, with `aseg` as atlas. The viewer shows 'Coronal' plane, smoothed white matter, 'Ventricle', and 'Cerebellum' all together in one scene. -```{r} -brain <- freesurfer_brain2( +```{r, eval=FALSE} +brain <- threeBrain( subject_path, subject_code, surface_types = c('pial', 'smoothwm'), atlas_types = 'aseg') diff --git a/vignettes/B-data-visualization.Rmd b/vignettes/B-data-visualization.Rmd index 2aae1bc7..5c63374a 100644 --- a/vignettes/B-data-visualization.Rmd +++ b/vignettes/B-data-visualization.Rmd @@ -20,11 +20,11 @@ knitr::opts_chunk$set( This article uses `N27` sample files mentioned by the previous vignettes. If you are using this example, please execute the following R code to set up. Alternatively, you can substitute variables `subject_code` and `subject_path` accordingly. -```{r setup} +```{r setup, eval=FALSE} library(threeBrain) subject_code <- "N27" subject_path <- "~/Downloads/N27" -brain <- freesurfer_brain2(subject_path, subject_code) +brain <- threeBrain(subject_path, subject_code) ``` ## Add Electrodes @@ -38,7 +38,7 @@ If you have performed electrode localization (see the previous article) and expo For demonstration purposes, this [electrode table](https://raw.githubusercontent.com/dipterix/threeBrain-sample/master/vignettes/electrodes.csv) will be used. Please download this file and place it at `~/Downloads/N27/electrodes.csv` -```{r} +```{r, eval=FALSE} electrode_table <- `~/Downloads/N27/electrodes.csv` brain$set_electrodes(electrode_table) brain$plot() @@ -83,7 +83,7 @@ The column names are case-sensitive, and should only contain letters, digits and Download sample value table from [here](https://github.com/dipterix/threeBrain-sample/blob/master/vignettes/values.csv) and save it to `~/Downloads/N27/values.csv` -```{r} +```{r, eval=FALSE} electrode_table <- `~/Downloads/N27/electrodes.csv` value_table <- `~/Downloads/N27/values.csv` brain$set_electrodes(electrode_table) @@ -104,7 +104,7 @@ In the example above, the p-value legend shows the range is from `-0.5` to `0.5` In the following code, `value_ranges` is a named list of such value ranges. `"p_value"=c(0,1)` suggests that the `p_value` variable should range from 0 to 1. All other variables adopt the default ranges. `palettes` is a named list of color palettes. In this specific case, variable `pal` is a vector of 64 colors. `colorRampPalette` is a base-R function to interpolate colors. Please use `help("colorRampPalette")` to see the documentation. -```{r} +```{r, eval=FALSE} pal <- c( colorRampPalette(c("red", "#FFC6C6"))(8), colorRampPalette(c("#FFC6C6", "white"))(56)