Armeet Singh Jatyani

Web MRI Volume Renderer in Rust

Over the weekend, I made a GPU-accelerated 3D MRI volume renderer written in Rust that compiles to WASM and runs directly in web.

Demo GIF

Here’s my repo: github. I’m open to PR’s! You should go checkout the demo application website and video (15s).

Back when I was a researcher working on AI models for 3D medical imaging, one of the problems I faced frequently was visualizing extremely dense (512³) MRI volumes (I was working with knee and brain MRI primarily) directly in 3D. Matplotlib doesn’t have interactive 3D support and plotly didn’t work for my use case. Raw MRI samples from the SKM-TEA 3D dataset can be ~8GB per sample. The best I could do was visualize 2D cross-sections.

So this weekend, I wrote my own interactive 3D volume renderer. The client is written in Rust, using egui/ eframe and compiles to WASM with trunk. The core volume renderer uses glow and targets WebGL in the browser, implementing a ray marching approach. The server is written in axum and serves volumes stored on disk. I specifically chose a client-server architecture to allow for future expansion (e.g., loading volumes from a database, more advanced chunking and rendering of massive volumes, etc).

Here’s what I used and why.

Features

#rust #tech #web