Skip to content

Commit

Permalink
Fixing readme and vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed May 3, 2024
1 parent b28c064 commit 0dfb053
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ 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
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
Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions vignettes/A-getting-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
```

Expand Down Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions vignettes/B-data-visualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 0dfb053

Please sign in to comment.