A web-based 3D brain MRI viewer that converts NIfTI brain scans into interactive 3D models with adjustable depth visualization.
- 3D Brain Visualization - Upload brain MRI scans and view them as interactive 3D models
- Depth Control - Adjust threshold to explore from outer cortex to deep internal structures
- Transparency - Control opacity to see through layers
- MRI Slices - View Axial, Sagittal, and Coronal slices with interactive sliders
- Slice Plane Overlay - Toggle slice images directly on the 3D model
- Wireframe Mode - Toggle mesh wireframe visualization with adjustable detail
- Auto-Rotate - Smooth automatic rotation for presentation
- Color Themes - Multiple professional color schemes
- Desktop App - Available as standalone application for Mac and Windows
- Python 3.8+
- FastAPI
- nibabel
- numpy
- scipy
- scikit-image
- Pillow
- uvicorn
- Modern web browser with WebGL support
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/neuroview.git
cd neuroview- Install Python dependencies:
pip install fastapi uvicorn nibabel numpy scipy scikit-image pillow- Start the backend server:
cd backend
python server.py- Open
brain_viewer.htmlin your browser
- Start the server (runs on
http://localhost:8000) - Open
brain_viewer.htmlin your browser - Upload a NIfTI brain scan (
.niior.nii.gz) - Use the controls to explore:
- Depth (Threshold): Lower = outer surface, Higher = internal structures
- Opacity: Make the brain transparent
- Wireframe: See the mesh structure
- Slice sliders: Navigate through MRI slices
- NIfTI (
.nii) - Compressed NIfTI (
.nii.gz)
You can download skull-stripped brain MRI data using nilearn:
from nilearn import datasets
import nibabel as nib
mni = datasets.fetch_icbm152_2009()
t1_img = nib.load(mni['t1'])
mask_img = nib.load(mni['mask'])
# Apply mask for brain-only data
brain_only = t1_img.get_fdata() * mask_img.get_fdata()
brain_img = nib.Nifti1Image(brain_only, t1_img.affine)
nib.save(brain_img, 'brain_only.nii.gz')NeuroView can be built as a standalone desktop application for Mac and Windows.
./build_mac.shThis creates dist/NeuroView.app - a native macOS application.
build_windows.batThis creates dist/NeuroView/NeuroView.exe - a Windows executable.
- Python 3.8+
- pywebview
- pyinstaller
All build dependencies are included in requirements.txt.
- Frontend: HTML5, CSS3, JavaScript, Three.js
- Backend: Python, FastAPI, scikit-image (marching cubes)
- 3D Rendering: WebGL via Three.js
- Desktop: pywebview, PyInstaller
MIT License