Medical Imaging / Full Stack / AI Systems
Medical MRI Annotation Platform
Browser-based volumetric MRI annotation, versioned backend state, ML-ready exports, and a RAG-backed AI project assistant.
3
Anatomical Planes
Axial / Coronal / Sagittal
NIfTI
Volume Format
.nii / .nii.gz in-browser parse
JSONB
Version History
Every save snapshotted in Postgres
RAG
AI Assistant
Groq + Postgres/pgvector retrieval
What It Does
This is a browser-based MRI annotation workstation for uploading NIfTI volumes, reviewing axial/coronal/sagittal slices, placing editable landmarks, and painting segmentation masks without opening desktop imaging software.
The backend persists clinical review state, landmarks, mask strokes, notes, and version history so annotations can be saved, restored, audited, and exported for ML or 3D Slicer workflows.
A companion Ask AI layer explains the system from indexed project documentation. It chunks Markdown notes, stores retrieval metadata in Postgres/pgvector, combines vector and keyword search, and uses Groq to generate source-grounded answers.
Why These Choices
NIfTI parsed in the browser: The user can inspect a medical volume immediately, before any large binary upload is needed.
Canvas rendering: Canvas gives precise control over slices, masks, landmark hit-testing, zoom, and overlay drawing.
FastAPI and Postgres: A Python backend handles annotation state and keeps the clinical workflow separate from the viewer UI.
JSONB version history: Each save stores a full annotation snapshot so previous review states can be restored.
RAG documentation layer: The project can be explained through a modern retrieval pipeline instead of static page copy only.
Architecture
Layer 1 - Frontend (Next.js / App Router)
NIfTI Upload
nifti-reader-js / local parse
Canvas Viewer
3-plane / zoom / slice controls
Annotation Tools
landmarks / masks / eraser
Layer 2 - API (FastAPI / Railway / Docker)
POST /annotations
save / upsert state
GET /annotations
load landmarks + masks
GET /export
Slicer + ML outputs
Layer 3 - Persistence
Neon Postgres
cases / landmarks / versions
JSONB Snapshots
full state per save
Supabase Storage
.nii.gz volume blobs
Layer 4 - Export and Downstream ML
Slicer Markup
3D Slicer-compatible JSON
Mask Export
segmentation JSON / NIfTI
ML Dataset
landmark coords + labelmaps
Layer 5 - AI Documentation (RAG / pgvector / Groq)
Markdown Corpus
project / thesis / CV-ready docs
Hybrid Retrieval
pgvector + keyword ranking
Groq Answering
source-grounded citations
Feature Highlights
3-Plane MRI Viewer
Axial, coronal, and sagittal slices rendered on HTML5 Canvas with slice controls and grayscale volume rendering.
Editable Landmarks
Named, colored point markers can be placed, selected, moved, renamed, resized, recolored, and deleted.
Brush Segmentation
Paint and erase segmentation masks with adjustable radius, opacity, labels, and 3D region-growing seed behavior.
Versioned State
Every explicit save creates a JSONB snapshot in Postgres so a case can be reviewed or restored later.
ML-Ready Exports
Exports include JSON, 3D Slicer markup, segmentation masks, and segmentation NIfTI files for downstream ML workflows.
RAG Project Assistant
The Ask AI page indexes Markdown project notes with hybrid retrieval, then uses Groq to answer architecture questions with citations.
Ask the AI assistant about this architecture
The assistant can explain how the annotation workflow, backend persistence, ML exports, and RAG layer fit together using indexed project documentation.