Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

115 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 BrainViz - EEG Signal Viewer Chrome Extension

BrainViz is a lightweight Chrome extension designed for researchers, students, and clinicians working with brainwave data. It enables fast and intuitive visualization of EEG signals from .txt and .edf files directly in the browser, with filtering, channel control, and PSD analysis.

Features

πŸš€ Core EEG Viewer

  • .edf and .txt Support: Upload EEG signals from common biomedical formats
  • Auto File Interception: Detects and opens EEG downloads from PhysioNet and similar sources
  • Offline File Viewer: Manually upload files via the popup panel
  • Interactive UI: Play, scroll, and zoom through signal windows

🧠 Signal Processing

  • Channel Selection: Toggle and focus on individual EEG channels
  • Stacked & Compact Modes: Choose between clinical-style or overlay visualization
  • Filtering Tools: Apply bandpass, lowpass, highpass, or notch filters (50Hz/60Hz)
  • Real-Time Time Slider: Navigate large EEG datasets with a draggable canvas-based slider
  • Python-Powered Filtering: Uses Pyodide with SciPy for advanced signal processing

🎡 Frequency Analysis

  • Power Spectral Density (PSD): Generate PSD plots to observe signal frequency patterns
  • Channel-wise PSD: Analyze frequency band activity per selected channel
  • Overlay Comparison: Preview multiple channel spectra
  • Band Topomaps: Visualize Delta, Theta, Alpha, and Beta frequency bands as brain topographic maps

πŸ“ File Management

  • Download Detection: Intercepts .edf or .txt EEG downloads for instant preview
  • Storage Fallbacks: Uses IndexedDB and Chrome storage for large file handling

πŸ“¦ Installation

πŸ”— From Chrome Web Store (Coming Soon)

πŸ§ͺ Developer Installation

  1. Clone this repository:
git clone https://github.com/your-username/brainviz.git
cd brainviz
  1. Load in Chrome:
  • Open chrome://extensions/
  • Enable Developer Mode
  • Click Load unpacked and select the root project folder

Quick Start

1. Open the Extension

  • Click the BrainViz icon in your Chrome toolbar
  • Use the popup to upload an EEG file manually or intercept a download

2. Launch the EEG Viewer

  • EEG files auto-open the signal viewer UI

  • Use the top menu to:

    • Select channels
    • Apply filters
    • Toggle PSD or stacked mode
    • Toggle Topomap on PSD Screen

3. Analyze the Signal

  • Use the slider to scroll across the EEG timeline
  • Click "Show PSD" for frequency analysis
  • View brain topomaps for different frequency bands
  • Export results or view channel overlays

Viewer Functions

Signal Display

  • View multiple channels aligned with timestamp labels
  • Adjust signal amplitude scale (e.g., 2 Β΅V/mm)
  • Switch between compact/stacked view

Controls

  • Filter dropdowns
  • PSD toggle button
  • Canvas-based EEG window slider
  • Channel checkbox panel

File Types

  • .edf (standard EEG format)
  • .txt (structured signal arrays)

Project Structure

BrainViz/
β”œβ”€β”€ icons/                         # Extension icons
β”‚   β”œβ”€β”€ Brainviz16.png
β”‚   β”œβ”€β”€ Brainviz48.png
β”‚   └── Brainviz128.png
β”‚
β”œβ”€β”€ libs/                          # JavaScript libraries and Python packages
β”‚   β”œβ”€β”€ EdfDecoder.js              # EDF file decoder
β”‚   β”œβ”€β”€ jsEDF.js                   # JavaScript EDF parser
β”‚   β”œβ”€β”€ plotly.min.js              # Plotly.js for data visualization
β”‚   β”œβ”€β”€ pyodide.js                 # Python in the browser runtime
β”‚   β”œβ”€β”€ pyodide.asm.js             # Pyodide WebAssembly interface
β”‚   β”œβ”€β”€ pyodide.asm.wasm           # Pyodide WebAssembly binary
β”‚   β”œβ”€β”€ pyodide-lock.json          # Pyodide package lock file
β”‚   β”œβ”€β”€ python_stdlib.zip          # Python standard library
β”‚   β”œβ”€β”€ numpy-1.26.4-cp311-cp311-emscripten_3_1_46_wasm32.whl  # NumPy for signal processing
β”‚   β”œβ”€β”€ scipy-1.11.2-cp311-cp311-emscripten_3_1_46_wasm32.whl  # SciPy for filtering
β”‚   └── openblas-0.3.23.zip        # Linear algebra library
β”‚
β”œβ”€β”€ background.js                 # Service worker (background logic)
β”œβ”€β”€ contentScript.js              # Injected into pages to enable EEG detection
β”œβ”€β”€ eegStorage.js                 # Handles large file storage using IndexedDB
β”œβ”€β”€ index.html                    # Extension popup UI
β”œβ”€β”€ manifest.json                 # Extension configuration (Manifest v3)
β”œβ”€β”€ popup.js                      # Logic for popup panel and file upload
β”œβ”€β”€ scriptInjector.js             # Injects scripts into web pages for EEG detection
β”œβ”€β”€ viewer.html                   # EEG viewer interface
β”œβ”€β”€ viewer.js                     # EEG signal rendering and analysis logic
β”œβ”€β”€ privacy-policy.md             # Privacy policy for Chrome Web Store
└── README.md                     # Project documentation

⚠️ Known Issues

  • Interception may fail if page disables content scripts or uses custom download logic.

🧰 Troubleshooting

Issue Solution
EEG file is downloaded Check that "Intercept Downloads" is ON in the popup
Viewer shows "No Data" Make sure your file has valid headers and numeric rows
Content not displaying File may be HTML or invalid EEG data (check devtools/network tab)
Not working on some pages Some domains restrict extension scripts (e.g. chrome:// or sandboxed pages)
Python engine not ready Wait a few seconds for Pyodide to initialize before using filters
Topomaps not showing Ensure at least 3 channels are selected and mappable to electrode positions

Development

Build

No npm build step required. This is a vanilla JS/HTML/CSS extension using Chrome Extension Manifest V3 with Pyodide for Python functionality.

To test changes:

  • Reload extension in chrome://extensions/
  • Click icon and try file upload or download interception

Debugging

  • Open Chrome DevTools on viewer.html or popup
  • Use console.log() in background.js and viewer.js to trace events
  • Monitor chrome://extensions/ for errors

Privacy Policy

This extension processes EEG files locally in your browser using client-side Python via Pyodide. No user-identifiable data is collected, transmitted, or stored on external servers. All signal processing happens entirely within your browser.

Support & Contributions

Acknowledgments

  • Supported by MIE

  • JavaScript Libraries:

    • Plotly.js- Interactive data visualization
    • jsEDF.js - JavaScript EDF file parser
    • EdfDecoder.js - Additional EDF decoding capabilities
  • Python in Browser:

    • Pyodide - Python scientific stack in WebAssembly
    • NumPy - Numerical computing for signal processing
    • SciPy - Scientific computing and signal filtering
    • OpenBLAS - Optimized linear algebra library
  • EEG Dataset Support:

    • Testing with PhysioNet datasets
    • 10-20 International System electrode positioning
  • Browser APIs:

    • Chrome Extension APIs (Storage, Downloads, Tabs)
    • IndexedDB for large file handling
    • Web Workers for background processing

Project Demo

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages