Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

3D Visualization of Brain MRI

NotificationsYou must be signed in to change notification settings

dipterix/threeBrain

Repository files navigation

CRAN_Status_BadgeR-CMD-checkProject Status: Active – The project has reached a stable, usable state and is being actively developed.DOI-RAVEDOI-YAEL

Key Features:

  • Uses modern browsers, easy toembed andshare
  • Displays MRI, surfaces, and electrodes in the same canvas
  • Maps multiple subjects on template brains usingAFNI/SUMA (standard 141) orMNI-305 locations
  • Electrode localization
  • Volume rendering and surface/electrodeanimation
  • Integration with interactiveR-shiny framework

News |reference page |keyboard shortcuts

System Requirement

  • Web Browsers: the viewer usesWegGL2 to render in browsers. Please checkthis list to see compatible browsers. As of 2023,Chrome,Firefox,Safari, andEdge (not IE) have full supports.

A. Installation

  1. R andRStudio Desktop (Free Version)
  2. OpenRStudio, enter from its console:
install.packages("threeBrain",repos="https://rave-ieeg.r-universe.dev")

If you want to installdev version fromGithub, then use:

install.packages("remotes")remotes::install_github("dipterix/threeBrain")
  1. (Optional) Setups: after installation, inRStudio console, type the following command
threeBrain::brain_setup()

and follow the instructions.

B. Basic Brain Viewer

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

library(threeBrain)default_template_directory()#> [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 thethreeBrain function.

  1. Import subject
library(threeBrain)n27_path<- file.path(default_template_directory(),"N27")x<- threeBrain(path=n27_path,subject_code='N27',surface_types='pial')
  1. Visualize
plot(x)# alternatively, you can use x$plot()`

C. Subject Setup

The sample subject (N27) is a sample generated byFreeSurfer (download). If you have any subjects processed byFreeSurfer, use functionthreeBrain to visualize.

D. Add/Render Electrodes

If you have electrode file, you can import it before callingplot function. Please make sure it's incsv format.

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, andLabel (character).Coord_* istkRAS location fromFreeSurfer 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

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 andTime are optional. However, if you are also usingrave, please make sureProject 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 withFreeSurfer output, for example, I have two subjectsYAB andYCQ. To merge these two subjects and show them onN27 template,

library(threeBrain)# yab = ... (see section B for import a single subject)# ycq = ...template_n27= merge_brain(yab,ycq,template_subject='N27')plot(template_n27 )

The viewer will be inN27 template, 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 intoRAVE (R Analysis and Visualization of iEEG). Please check our websitehttps://rave.wiki

Here is asfN poster

Citation

To citethreeBrain 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.


[8]ページ先頭

©2009-2025 Movatter.jp