Brainchop: In-browser MRI volumetric segmentation and rendering

Mohamed Masoud, Farfalla Hu, Sergey M. PlisJ. Open Source Softw 2023 · DOI · DBLP

Abstract

Brainchop is an open-source, web-based tool designed to bring professional-grade MRI volumetric segmentation directly to the browser. By leveraging lightweight deep learning models (MeshNet) executed locally via TensorFlow.js, Brainchop eliminates the need for complex software installations or privacy-risky server uploads. This approach democratizes advanced neuroimaging analysis, making it accessible to clinicians and researchers regardless of their technical infrastructure or geographic location.

Introduction

Accurate segmentation of brain tissue—identifying structures such as gray matter, white matter, and specific cortical regions—is fundamental to neuroimaging research and clinical practice. However, traditional segmentation suites like FreeSurfer or SPM often require high-end hardware, specialized Linux environments, and significant technical expertise. This "technological barrier" disproportionately affects clinicians in resource-limited settings. Furthermore, existing web-based solutions typically require uploading sensitive medical data to remote servers, raising substantial data privacy concerns. Brainchop addresses these challenges by providing a "zero-install," privacy-first platform that performs all computations entirely on the client side.

Methods

The Brainchop pipeline bridges the gap between resource-intensive research models and the constraints of a standard web browser environment.

Model Architecture

Brainchop utilizes MeshNet, a lightweight neural network architecture optimized for volumetric data. The implementation incorporates volumetric dilated convolutions, allowing the network to capture a larger receptive field without a prohibitive increase in parameter count.

Technical Stack and Workflow

Models are initially trained in PyTorch and subsequently converted to TensorFlow.js for browser deployment. To handle complex preprocessing tasks such as reshaping and resampling MRI data, Brainchop employs Pyodide to run standard neuroimaging functions within the browser.

The Brainchop workflow: from model training in PyTorch to client-side inference and visualization in the browser.

All computations utilize local hardware acceleration (CPU/GPU) via the browser. For visualization, the tool integrates the Papaya viewer for 2D/3D slice viewing and Three.js for real-time 3D rendering of segmented volumes.

Datasets and Standardization

Brainchop provides pre-trained models for several key tasks, including Gray Matter/White Matter (GMWM) segmentation and brain atlas generation (segmenting 50 cortical and 104 subcortical structures). The tool expects input in the standard NIfTI format, specifically T1-weighted MRI volumes.

Results

Evaluation of the MeshNet implementation against the industry-standard U-Net architecture reveals significant efficiency gains with comparable accuracy.

  • Accuracy: The MeshNet GMWM model achieved a Macro DICE score of 0.96, matching the performance of the much larger U-Net.
  • Efficiency: MeshNet processed 116 subvolumes per second, a nearly nine-fold increase over U-Net's 13 subvolumes per second.
  • Portability: The MeshNet model is exceptionally compact at 0.89 MB, compared to U-Net’s 288 MB, making it ideal for web delivery.
Brainchop user interface displaying various segmentation outputs, including GM/WM masks and multi-region cortical atlases.

Discussion and Limitations

By moving computation to the browser, Brainchop effectively turns any modern laptop into a neuroimaging workstation. This "privacy by design" approach bypasses the legal and ethical hurdles associated with cloud-based medical AI.

Current limitations include the occasional production of "noisy" regions in 3D inference, which the authors mitigate using a 3D connected-components filter. Future work may involve supporting additional MRI modalities and expanding the library of pre-trained models for specific pathologies or age groups.

Summary updated

BibTeX
@article{masoud2023brainchop,
  author = {Mohamed Masoud and Farfalla Hu and Sergey M. Plis and Mohamed Masoud and Farfalla Hu and Sergey Plis},
  title = {{Brainchop: In-browser MRI volumetric segmentation and rendering}},
  journal = {J. Open Source Softw.},
  year = {2023},
  doi = {10.21105/joss.05098},
}
Figure