User:Dipterix/sandbox

= Rave =

RAVE (R Analysis and Visualization of iEEG) is an open-source free statistical software package designed for intracranial electroencephalography (iEEG) study. The package provides a full preprocessing pipeline, customizable data exploratory modules, and cross-subject group analyses. RAVE is mostly implemented in R language. Its server-browser design allows the users to interact to the powerful analysis tools with web browsers.

Background
Intracranial electroencephalography (iEEG) offers a unique window into the neurobiology of human perception and cognition. Direct recording of neural activity from the human brain using implanted electrodes (iEEG, intracranial electroencephalography) is a fast-growing technique in human neuroscience. While the ability to record from the human brain with high spatial and temporal resolution has advanced our understanding, it generates staggering amounts of data: a single patient can be implanted with hundreds of electrodes, each sampled thousands of times a second for hours or days. The difficulty of exploring these vast datasets is the rate-limiting step in discovery. In addition, the lack of statistically-sophisticated, easy-to-use software for analysis of iEEG data is a significant obstacle to progress. RAVE is designed to resolve these issues. Without writing a single line of code, users can create custom analyses and apply them to data from hundreds of iEEG electrodes at the individual subject or group level, then visualize the results on MRIs and cortical surface models. Plots in RAVE are automatically generated based on changes to user input and can be downloaded as publication-ready (vector or raster) graphics with a single click. RAVE consists of approximately 70,000 lines of code, designed to prioritize an interactive user experience, reliability and reproducibility. There is also a wiki with detailed installation instructions and video tutorials covering input, preprocessing, analysis and visualization.

Availability
RAVE is freely available at rave.wiki. The source code is published on Github at https://github.com/beauchamplab/rave

Software Architecture & Principles
RAVE is implemented in R, C++, and JavaScript. Its front-end is implemented in R-shiny framework. The low-level functions such as signal processing and gigabyte-level disk I/O are written in C++ (Boost, OpenMP). The 3D brain viewer is written in JavaScript with the famous three.js framework.

The following techniques are used in RAVE:


 * R-shiny: An easy-to-write framework to build browser applications in R
 * Rcpp: Seamless C/C++ integration in R
 * Htmlwidgets: Seamless JavaScript widgets in R
 * Three.js: A modern WebGL-based framework to build interactive 3D models in web browsers

The design philosophy of RAVE is based on five principles. The first principle is rigorous statistical methodology. The history of fMRI has been marked by tumult over problematic statistics, such as "voodoo correlations" resulting from biased analyses (Simmons et al., 2007; Vul et al., 2009); treating subjects as fixed vs. random effects (Mumford and Nichols, 2009); and the "dead salmon" debate over how to correct for multiple comparisons (Bennett et al., 2009; Eklund et al., 2016; Cox et al., 2017). To encourage statistical best practices, RAVE is developed using "R", a free, open source statistical language with a rich framework of existing packages developed by leading statistical and machine learning researchers (R Computing, 2017). RAVE implements robust statistical tests, such as linear mixed-effects models, in a rigorous and community-vetted fashion (Bates et al., 2015; Kuznetsova et al., 2017).

The second principle is to keep users close to the data so that users may make discoveries about the brain without being misled by artifacts. This necessitates a well-designed graphical-user interface (GUI) so that users can explore very large iEEG datasets combined with efficient algorithm implementation to display analysis results quickly enough for real-time, interactive interrogation.

The third principle is to run anywhere. RAVE is designed so that all user interactions can take place within a web browser. This makes RAVE platform and processor independent, running on tablets, desktops, or clusters. The RAVE front-end experience is the same whether data and computing resources are located on the user's own machine, a lab server, or a cloud-based computing service such as Amazon Web Services.

The fourth principle is to prioritize reliability and reproducibility in all aspects of RAVE development. Funding agencies and journals have recognized that data sharing is a key ingredient in speeding scientific progress, with all research programs supported by the United States National Institutes of Health Brain Research through Advancing Innovative Neurotechnologies (BRAIN) required to submit their research data to an approved archive (Zhan, 2019). Archive submission often entails a laborious collection and curation process on the part of investigators. RAVE simplifies this process by automatically harmonizing all iEEG data files from each participant, together with meta-data such as task epoch files, in a format acceptable to archives. All processing commands used to generate a particular file or analysis can be easily documented for attachment to manuscript figures.

The final principle is to play well with others. Each laboratory has its own ecosystem of software tools and methods with expertise and protocols developed over years of experience. Therefore, RAVE is designed to integrate seamlessly with existing workflows, such as iELVis (Groppe et al., 2017) and img_pipe (Hamilton et al., 2017) for electrode localization. Along with an extensive GUI, RAVE provides a robust application programming interface (API) to support integration of RAVE with existing or novel analysis pipelines.

Use Case
The user always interacts with RAVE using a web browser on a local machine (desktop, laptop or tablet). The location of the data repository and the hardware used for analysis computations may be independently configured, creating a variety of possible deployment strategies.


 * In hospital environments, internet access is usually limited (an investigator preparing a manuscript on an airplane is similarly challenged). For these situations, RAVE would run on a local machine such as desktop or laptop with the user interactions taking place within a web browser on the same machine. Both data and analysis computations would take place on the local machine.
 * In laboratory environments, inexpensive shared data storage is often used so that lab members to access data from many different projects and subjects (a 20 TB RAID can be purchased for less than $1000USD). In this scenario, RAVE runs on each user's local machine, controlled via web browser. All analysis takes place locally, but data is stored on the shared RAID (typically accessed via a mount point).
 * A third type of deployment places analysis at a laboratory level on a shared lab compute server, such as a cluster. In this configuration, multiple RAVE sessions are run in parallel on the server, controlled by a web browser on each user's local machine. Analysis and storage take place on the central compute server/RAID. This configuration has two advantages. First, compute servers can be equipped with dozens of cores and TB of RAM, increasing processing speed. Second, large data files are transferred exclusively over fast connections between the compute server and the RAID (both of which would often be hosted in a university data center) rather than slower desktop connections between the data center and the desktop. Network performance for desktop connections can vary, especially for telework situations in which the user is connecting via virtual private network (VPN).
 * Other deployments are also possible. An investigator might upload a large library of iEEG data to an online repository (Miller, 2019). Users running RAVE on their local machine could set the data location to the online repository, resulting in local analysis with remote storage. Alternately, in a multi-lab collaboration, a private data repository could hold all data collected across labs, with each lab's compute server connecting to the repository for laboratory-level analysis with remote storage.
 * A final deployment strategy places both analysis and storage "in the cloud". This would be appropriate for a comprehensive data repository, such as those under construction for the NIH BRAIN Initiative including NEMAR (Franklin, 2019) and DABI (Toga et al., 2019). A user would run a web browser on their local machine and point it to an instance of RAVE running on an academic or commercial cloud computing service, which would also host the entire data archive.