All Projects → dipterix → threeBrain

dipterix / threeBrain

Licence: other
3D Visualization of Brain MRI

Programming Languages

javascript
184084 projects - #8 most used programming language
r
7636 projects

Projects that are alternatives of or similar to threeBrain

Mne Python
MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
Stars: ✭ 1,766 (+5989.66%)
Mutual labels:  neuroimaging, electroencephalography, ecog
mne-bids
MNE-BIDS is a Python package that allows you to read and write BIDS-compatible datasets with the help of MNE-Python.
Stars: ✭ 88 (+203.45%)
Mutual labels:  neuroimaging, electroencephalography, ieeg
Fieldtrip
The MATLAB toolbox for MEG, EEG and iEEG analysis
Stars: ✭ 481 (+1558.62%)
Mutual labels:  neuroimaging, brain
syncopy
Systems Neuroscience Computing in Python: user-friendly analysis of large-scale electrophysiology data
Stars: ✭ 19 (-34.48%)
Mutual labels:  brain, ecog
bids-matlab
MATLAB / Octave tools for BIDS datasets
Stars: ✭ 37 (+27.59%)
Mutual labels:  neuroimaging, ieeg
pybv
A lightweight I/O utility for the BrainVision data format, written in Python.
Stars: ✭ 18 (-37.93%)
Mutual labels:  brain, ieeg
ColeAnticevicNetPartition
Public release of The Cole-Anticevic Brain-wide Network Partition (CAB-NP)
Stars: ✭ 48 (+65.52%)
Mutual labels:  neuroimaging, brain
MIRACL
Multi-modal Image Registration And Connectivity anaLysis
Stars: ✭ 23 (-20.69%)
Mutual labels:  neuroimaging, brain
ANTsR
Advanced Normalization Tools in R
Stars: ✭ 101 (+248.28%)
Mutual labels:  brain
NSVLocalizationKit
Localize directly from Storyboard or Xib, it will automatically update all texts after in app language changing, without any line of code
Stars: ✭ 21 (-27.59%)
Mutual labels:  localization
android-api-loquacious
Loquacious is a localized remote resource manager library for Android
Stars: ✭ 24 (-17.24%)
Mutual labels:  localization
www.gafam.info
Sources of the gafam.info web page
Stars: ✭ 14 (-51.72%)
Mutual labels:  localization
mobility-actiontext
Translate Rails Action Text rich text with Mobility.
Stars: ✭ 27 (-6.9%)
Mutual labels:  localization
CMRNet
Code for "CMRNet: Camera to LiDAR-Map Registration" (ITSC 2019) - WIP
Stars: ✭ 70 (+141.38%)
Mutual labels:  localization
bidscoin
BIDScoin converts your source-level neuroimaging data to BIDS
Stars: ✭ 75 (+158.62%)
Mutual labels:  neuroimaging
prime-re.github.io
Open resource exchange platform for non-human primate neuroimaging
Stars: ✭ 13 (-55.17%)
Mutual labels:  brain
DeepHyperNEAT
A public python implementation of the DeepHyperNEAT system for evolving neural networks. Developed by Felix Sosa and Kenneth Stanley. See paper here: https://eplex.cs.ucf.edu/papers/sosa_ugrad_report18.pdf
Stars: ✭ 42 (+44.83%)
Mutual labels:  brain
Neuroimaging.jl
Neuroimaging in Julia
Stars: ✭ 39 (+34.48%)
Mutual labels:  neuroimaging
laravel-query-localization
Easy Localization for Laravel
Stars: ✭ 50 (+72.41%)
Mutual labels:  localization
laravel-localized-routes
A convenient way to set up and use localized routes in a Laravel app.
Stars: ✭ 257 (+786.21%)
Mutual labels:  localization

threeBrain - HTML, WebGL based 3D Viewer

CRAN_Status_Badge license R-CMD-check Project Status: Active – The project has reached a stable, usable state and is being actively developed. DOI

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 in 3 approaches
  • 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 2020, Chrome, Firefox, and Edge (not IE) have full supports.
    • For Safari users, please enable this feature by going to Safari > Preferences, click Advanced, then select Show Develop menu in menu bar; then click Develop in the menu bar, go to Experimental Features > WebGL 2.0. This only needs to be done once.

A. Installation

  1. R and RStudio Desktop (Free Version)
  2. Open RStudio, enter from its console:
install.packages("threeBrain")

If you want to install dev version from Github, then use:

install.packages("remotes")
remotes::install_github("dipterix/threeBrain")
  1. (Optional) Setups: after installation, in RStudio console, type the following command
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:

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 the freesurfer_brain2 function.

  1. Import subject
library(threeBrain)

n27_path <- file.path(default_template_directory(), "N27")

x <- freesurfer_brain2( fs_subject_folder = n27_path,
  subject_name = 'N27', surface_types = 'pial')
  1. Visualize
plot(x)       # alternatively, you can use `n27$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 freesurfer_brain2 to visualize.

The AFNI/SUMA standard 141 brain is also supported. Please use terminal command @SUMA_Make_Spec_FS -NIFTI -sid [subID] to generate 141 brain. (Click here for some hints)

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.

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

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,

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 in N27 template, and electrodes of these two subjects can be mapped via MNI305 (for surface and stereo EEG) or std.141 (for surface-only).

F. Electrode Localization

(Do NOT use this feature for clinical purposes!)

As of version 0.2.1, threeBrain supports electrode localization. You can:

  • Use template brain to generate electrode table, when you don't have subject-level MRI
  • Use subject MRI to generate when CT scans are unavailable
  • Use CT co-registered to MRI

Use template brain to generate electrode table

Create a blank template and localize:

library(threeBrain)
template <- merge_brain()
template$localize()

Use subject MRI to generate when CT scans are unavailable

If you have MRI but don't have CT scans, it is possible to use MRI slices. Make sure to change fs_subject_folder accordingly:

x <- freesurfer_brain2( 
  fs_subject_folder = file.path(default_template_directory(), "N27"),
  subject_name = 'N27', surface_types = 'pial')
  
x$localize()

Use CT co-registered to MRI

If you have CT images, please co-register with MRI first. This requires dcm2nii (link) or dcm2niix (link), and FLIRT package (link).

Step 1: Merge all DICOM images to Nifti format:

Open your terminal, change directories to where CT images are, and run

dcm2niix [folder with DICOM images]

Do the same to T1 MR images too.

Step 2: Copy the two .nii files generated in the previous step to a same folder, rename them to be ct.nii and t1.nii

flirt -in ct.nii -ref t1.nii -out ct_in_t1.nii -omat ct2t1.mat -interp trilinear -cost mutualinfo -dof 6 -searchcost mutualinfo -searchrx -180 180 -searchry -180 180 -searchrz -180 180 

There will be a ct_in_t1.nii file generated.

Step 3: Localize

Open RStudio, type and change the file path to ct_in_t1.nii just created

# Import 3D brain
# x <- freesurfer_brain2( ... ) 
x$localize( "[path to ct_in_t1.nii]" )

Citation

To cite threeBrain in publications use:

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 = {{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},
  }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].