https://github.com/dipterix/threebrain

3D Visualization of Brain MRI

https://github.com/dipterix/threebrain

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.3%) to scientific vocabulary

Keywords

brain ecog electroencephalography ieeg localization mri-brain neuroimaging r template-brains
Last synced: 5 months ago · JSON representation

Repository

3D Visualization of Brain MRI

Basic Info
Statistics
  • Stars: 47
  • Watchers: 2
  • Forks: 10
  • Open Issues: 1
  • Releases: 13
Topics
brain ecog electroencephalography ieeg localization mri-brain neuroimaging r template-brains
Created almost 7 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog

README.md

threeBrain - HTML, WebGL based 3D Viewer

CRAN_Status_Badge R-CMD-check Project Status: Active – The project has reached a stable, usable state and is being actively developed. DOI-RAVE DOI-YAEL <!-- badges: end -->

Key Features:

  • Uses modern browsers, easy to embed and share
  • Displays MRI, surfaces, and electrodes in the same canvas
  • Maps multiple subjects on template brains using AFNI/SUMA (standard 141) or MNI-305 locations
  • Electrode localization
  • Volume rendering and surface/electrode animation
  • Integration with interactive R-shiny framework

News | reference page | keyboard shortcuts

System Requirement

  • Web Browsers: the viewer uses WegGL2 to render in browsers. Please check this list to see compatible browsers. As of 2023, Chrome, Firefox, Safari, and Edge (not IE) have full supports.

A. Installation

  1. R and RStudio Desktop (Free Version)
  2. Open RStudio, enter from its console: r install.packages("threeBrain", repos = "https://rave-ieeg.r-universe.dev") If you want to install dev version from Github, then use: r install.packages("remotes") remotes::install_github("dipterix/threeBrain")
  3. (Optional) Setups: after installation, in RStudio console, type the following command r threeBrain::brain_setup() and follow the instructions.

B. Basic Brain Viewer

Once finishing setting up of threeBrain, there will be a template subject N27 (Collin's 27) created locally. The location is platform-related. You can find it by running the following command:

```r library(threeBrain)

defaulttemplatedirectory()

> [1] "/Users/dipterix/Library/Application Support/

> org.R-project.R/R/threeBrain/templates"

```

N27 template folder resides inside of this directory.

Let's view this subject using the threeBrain function.

  1. Import subject ```r library(threeBrain)

n27path <- file.path(defaulttemplate_directory(), "N27")

x <- threeBrain( path = n27path, subjectcode = 'N27', surface_types = 'pial') 2. Visualize r plot(x) # alternatively, you can use x$plot() ``

C. Subject Setup

The sample subject (N27) is a sample generated by FreeSurfer (download). If you have any subjects processed by FreeSurfer, use function threeBrain to visualize.

D. Add/Render Electrodes

If you have electrode file, you can import it before calling plot function. Please make sure it's in csv format. r x$set_electrodes(electrodes = "[PATH to ELECTRODE FILE]") Here is an example of electrode csv file. Only the first five columns (case-sensitive) are mandatory: Electrode (integer), Coord_x, Coord_y, Coord_z, and Label (character). Coord_* is tkRAS location from FreeSurfer coordinates. | Electrode| Coord_x| Coord_y| Coord_z|Label | MNI305_x| MNI305_y| MNI305_z|SurfaceElectrode |SurfaceType | Radius| VertexNumber|Hemisphere | |---------:|-------:|-------:|-------:|:------|--------:|---------:|---------:|:----------------|:-----------|------:|------------:|:----------| | 1| 29.0| -7.8| -34.6|RMHCH1 | 30.46817| -17.98119| -23.40022|FALSE |pial | 2| -1|left | | 2| 33.8| -8.0| -34.2|RMHCH2 | 35.57109| -17.76624| -22.80131|FALSE |pial | 2| -1|left | | 3| 38.0| -7.5| -33.5|RMHCH3 | 39.97102| -16.81249| -22.17986|FALSE |white | 2| -1|right | | 4| 42.6| -6.8| -33.0|RMHCH4 | 44.79092| -15.73442| -21.82591|FALSE |smoothwm | 2| -1|right | | 5| 47.0| -6.8| -32.6|RMHCH5 | 49.45370| -15.35431| -21.31272|FALSE |pial | 2| -1|right | | ...

To assign values to electrodes, run r x$set_electrode_values(electrodes = "[PATH to ELECTRODE VALUE FILE]")

The electrode value file is also a csv like:

| Electrode| Subject| Project| Time| ValueName| ValueName2| ...| |---------:|-------:|-------:|-------:|:---------|----------:|-----| | 1| N27| Demo| 0|A | 30.46817| ...| | 2| N27| Demo| 0|B | 35.57109| ...| | 3| N27| Demo| 0|C | 39.97102| ...| | 4| N27| Demo| 0|D | 44.79092| ...| | 5| N27| Demo| 0|A | 49.45370| ...| | ...

Project and Time are optional. However, if you are also using rave, please make sure Project exists. If you want to show animation, Time is necessary and must be numeric. ValueName? can be any characters containing letters (A-Z, a-z), letters (0-9) and underscore (_).

E. Merge Subjects and Template mapping

If you have your own subjects with FreeSurfer output, for example, I have two subjects YAB and YCQ. To merge these two subjects and show them on N27 template, ```r library(threeBrain)

yab = ... (see section B for import a single subject)

ycq = ...

templaten27 = mergebrain(yab, ycq, template_subject = 'N27')

plot( template_n27 ) `` The viewer will be inN27template, and electrodes of these two subjects can be mapped viaMNI305(for surface and stereo EEG) orstd.141` (for surface-only).

F. Electrode Localization (YAEL)

YAEL ("Your Advanced Electrode Localizer) has been integrated into RAVE (R Analysis and Visualization of iEEG). Please check our website https://rave.wiki

Here is a sfN poster

Citation

To cite threeBrain in publications use:

  • Wang, Z., Magnotti, J. F., Zhang, X., & Beauchamp, M. S. (2023). YAEL: Your Advanced Electrode Localizer. Eneuro, 10(10).
  • Magnotti, J. F., Wang, Z., & Beauchamp, M. S. (2020). RAVE: Comprehensive open-source software for reproducible analysis and visualization of intracranial EEG data. NeuroImage, 223, 117341.

A BibTeX entry for LaTeX users:

@Article{, title = {{YAEL}: Your Advanced Electrode Localizer}, author = {Zhengjia Wang and John F. Magnotti and Xiang Zhang and Michael S. Beauchamp}, journal = {Eneuro}, year = {2023}, volume = {10}, number = {10}, publisher = {Society for Neuroscience}, doi = {10.1523/ENEURO.0328-23.2023}, } @Article{, title = {{RAVE}: Comprehensive open-source software for reproducible analysis and visualization of intracranial EEG data}, author = {John F. Magnotti and Zhengjia Wang and Michael S. Beauchamp}, journal = {NeuroImage}, year = {2020}, volume = {223}, doi = {10.1016/j.neuroimage.2020.117341}, pages = {117341}, }

License

The front-end viewer (JavaScript) is licensed under MPL-2.0 free open-source license. Using the generated viewers or incorporating the existing viewers as a whole into your own work "as-is" is permissive.

Owner

  • Name: Dipterix Wang
  • Login: dipterix
  • Kind: user
  • Company: Perelman School of Medicine, University of Pennsylvania

When you are eating pineapple, pineapple is eating you as well.

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 7
  • Watch event: 7
  • Issue comment event: 10
  • Push event: 100
  • Fork event: 2
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 7
  • Watch event: 7
  • Issue comment event: 10
  • Push event: 100
  • Fork event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 783
  • Total Committers: 3
  • Avg Commits per committer: 261.0
  • Development Distribution Score (DDS): 0.254
Past Year
  • Commits: 110
  • Committers: 1
  • Avg Commits per committer: 110.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
dipterix d****g@g****m 584
dipterix z****3@r****u 198
z94007 z****7@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 16
  • Total pull requests: 24
  • Average time to close issues: 3 months
  • Average time to close pull requests: 19 days
  • Total issue authors: 4
  • Total pull request authors: 2
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.42
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 10
Past Year
  • Issues: 4
  • Pull requests: 0
  • Average time to close issues: about 1 month
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dipterix (10)
  • zhangjb35 (4)
  • ErnestJohnston (1)
  • sergiumocanu (1)
Pull Request Authors
  • dipterix (17)
  • dependabot[bot] (10)
Top Labels
Issue Labels
enhancement (4) high-priority (4) wontfix (2) bug (2) futher investigation needed (1)
Pull Request Labels
dependencies (10)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 536 last-month
  • Total docker downloads: 41,979
  • Total dependent packages: 2
  • Total dependent repositories: 6
  • Total versions: 18
  • Total maintainers: 1
cran.r-project.org: threeBrain

Your Advanced 3D Brain Visualization

  • Versions: 18
  • Dependent Packages: 2
  • Dependent Repositories: 6
  • Downloads: 536 Last month
  • Docker Downloads: 41,979
Rankings
Forks count: 7.3%
Stargazers count: 8.1%
Dependent repos count: 11.9%
Dependent packages count: 13.6%
Average: 14.9%
Downloads: 22.6%
Docker downloads count: 25.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R6 >= 2.3.0 imports
  • digest >= 0.6.22 imports
  • dipsaus * imports
  • freesurferformats >= 0.1.7 imports
  • gifti >= 0.7.5 imports
  • grDevices * imports
  • graphics * imports
  • htmlwidgets >= 1.3 imports
  • jsonlite >= 1.5 imports
  • oro.nifti >= 0.9.1 imports
  • shiny >= 1.2.0 imports
  • stringr >= 1.3.1 imports
  • utils * imports
  • xml2 * imports
  • DT * suggests
  • knitr * suggests
  • rmarkdown * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite