Inspiration

Medical students often spend years learning brain anatomy from flat, 2D MRI slices. Many existing 3D tools are costly, complicated, or don’t support teamwork. We wondered: what if studying neuroanatomy could feel as easy and collaborative as working in a shared Google Doc?

What it does

Safe Mind is a free, open-source, web-based 3D brain MRI viewer that combines real-time collaboration with advanced analysis tools.

How we built it

Frontend

HTML, CSS, JavaScript

Three.js for 3D rendering

Raycasting for placing annotations

WebSocket client for collaboration

Backend

Python with FastAPI

WebSockets for live synchronization

NiBabel, NumPy, SciPy, scikit-image (marching cubes)

Pillow for image processing

Vector database for case similarity search

Data Processing

Volumetric processing using the marching cubes algorithm

Multi-resolution mesh generation for performance

Slice extraction and PNG encoding

Tumor segmentation and mesh creation

Deployment

Hosted on Render with GitHub CI/CD

Desktop distribution via PyInstaller

Cross-platform support (Windows, macOS, Linux)

Challenges we ran into

Keeping camera movement, slices, and annotations synchronized without lag or feedback loops

Rendering large volumetric datasets efficiently (256 × 178 × 256 voxels)

Making 3D annotation placement intuitive using raycasting

Balancing mesh quality and real-time performance

Building reliable WebSocket communication for collaboration

Accomplishments that we're proud of

Making this.

What we learned

Designing WebSocket architectures for collaborative apps

3D interaction and raycasting in Three.js

Isosurface extraction using marching cubes

The importance of real-time state syncing in shared tools

Optimizing performance for 3D medical visualization

What's next for Safe Mind

Brain region labeling with anatomical overlays

Support for DICOM files

Mobile-friendly viewer

Expanded AI analysis capabilities

More advanced segmentation tools

PACS system integration

Advanced measurement tools

Built With

Share this project:

Updates