A web platform for whole-head MRI segmentation and transcranial electrical stimulation (TES) modeling. Upload a NIfTI MRI volume, run automated tissue segmentation across 12 classes, and optionally simulate tDCS/tACS electric field distributions.
CROWN segments whole-head MRI scans into 12 tissue classes:
| Label | Tissue |
|---|---|
| 0 | Background |
| 1 | White Matter (WM) |
| 2 | Gray Matter (GM) |
| 3 | Eyes |
| 4 | Cerebrospinal Fluid (CSF) |
| 5 | Air |
| 6 | Blood |
| 7 | Cancellous Bone |
| 8 | Cortical Bone |
| 9 | Skin |
| 10 | Fat |
| 11 | Muscle |
Six models spanning three architectures and two coordinate spaces:
| Architecture | Native Space | FreeSurfer Space |
|---|---|---|
| GRACE | grace-native |
grace-fs |
| DOMINO | domino-native |
domino-fs |
| DOMINO++ | dominopp-native |
dominopp-fs |
- Native space β output matches the input MRI's original coordinate system
- FreeSurfer space β output conformed to 1mm isotropic 256Γ256Γ256 standard space
After segmentation, run electric field simulations directly in the browser:
| Solver | Method | Time |
|---|---|---|
| ROAST | FEM via compiled MATLAB runtime | ~10β15 min (fast) / ~20β30 min (standard) |
| SimNIBS | FEM with charm meshing on GRACE segmentation | ~1β3 hrs |
Configure electrode montages (position, size, current), select simulation quality, and visualize the resulting electric field alongside the segmentation.
- Upload & Segment β Upload a NIfTI (.nii / .nii.gz) and select one or more models
- Interactive 3D/2D Viewer β Niivue-based side-by-side comparison with 14 colormap options; all colormaps render all 12 tissue labels without transparency
- Per-Panel Controls β Independent background visibility toggle per viewer panel
- Segmentation Legend β Color-matched tissue legend synced to the active colormap
- TES Wizard β Step-by-step electrode configuration and simulation workflow
- Real-time Progress β Server-Sent Events stream job status to the browser
- GPU Scheduling β Multi-GPU Redis-backed job queue for concurrent users
- Result Download β Download segmentation outputs as NIfTI files
ui_v2/ Next.js frontend β deployed on Vercel
api_v2/ FastAPI backend β deployed via Docker Compose
| Service | Description |
|---|---|
redis |
Job queue and GPU locking |
api |
FastAPI + GPU scheduler + ROAST + SimNIBS |
The frontend is deployed on Vercel and communicates with the backend via NEXT_PUBLIC_API_URL.
# Copy and fill in environment variables
cp api_v2/.env.example api_v2/.env
# Start Redis + API
docker compose up -d --buildRequired host mounts (set in .env or override defaults):
| Variable | Default | Description |
|---|---|---|
MODELS_HOST_PATH |
/home/chintan/wws_v2/api_v2/models |
Pre-trained model weights |
FREESURFER_LICENSE_PATH |
/home/chintan/licenses/freesurfer.txt |
FreeSurfer license |
ROAST_BUILD_DIR |
/home/chintan/roast11/build |
ROAST-11 compiled binary |
MATLAB_RUNTIME |
/home/chintan/MATLAB/MATLAB_Runtime/R2025b |
MCR for ROAST |
SIMNIBS_HOME |
/home/chintan/SimNIBS-4.5 |
SimNIBS installation |
cd ui_v2
npm install
npm run dev # http://localhost:3000Backend (api_v2/.env)
REDIS_HOST=redis
REDIS_PORT=6379
GPU_COUNT=4
JWT_SECRET=...
HMAC_SECRET=...
ROAST_BUILD_DIR=/opt/roast/build
MATLAB_RUNTIME=/opt/mcr/R2025b
ROAST_MAX_WORKERS=2
SIMNIBS_HOME=/opt/simnibs
SIMNIBS_N_THREADS=8
Frontend
NEXT_PUBLIC_API_URL=http://<server>:8000
- User uploads a NIfTI file and selects models + coordinate space
- Backend preprocesses the input (RAS orientation, 1mm resampling) and enqueues a job
- GPU scheduler assigns the job to an available GPU and runs inference
- Progress streams to the frontend via SSE
- Results load into the interactive viewer; user can optionally launch a TES simulation