The MRI Helper is an experimental asynchronous medical imaging application that processes NIfTI files for visualization and segmentation using deep learning models. The SegResNet model used for segmentation is trained by the MONAI community. The primary use cases include deployment within clinics or hospitals, either on-premise locally or on AWS within private subnets to ensure sensitive data privacy protection.
%%{init: {'theme':'base', 'themeVariables': { 'fontSize': '18px', 'fontFamily': 'Arial, sans-serif', 'primaryColor': '#ffffff', 'primaryTextColor': '#000000', 'primaryBorderColor': '#000000', 'lineColor': '#000000', 'secondaryColor': '#ffffff', 'tertiaryColor': '#ffffff'}}}%%
graph TD
%% Client Layer
subgraph Client["<b>Client Layer</b>"]
User["<b>User/Doctor</b>"]
Browser["<b>Web Browser</b>"]
end
%% Application Layer
subgraph App["<b>Application Layer</b>"]
Frontend["<b>React Frontend</b><br/>Port 8000<br/>VTK.js 3D Viewer<br/>File Upload UI"]
end
%% API Layer
subgraph API["<b>API Layer</b>"]
FastAPI["<b>FastAPI Backend</b><br/>Port 8001<br/>MRI Master API<br/>File Upload Handler<br/>SSE Events"]
end
%% Processing Layer
subgraph Processing["<b>Processing Layer</b>"]
Celery["<b>Celery Worker</b><br/>ONNX Models<br/>SegResNet<br/>NIfTI Processing<br/>VTK Conversion"]
end
%% Infrastructure Layer
subgraph Infrastructure["<b>Infrastructure Layer</b>"]
RabbitMQ["<b>RabbitMQ</b><br/>Message Queue<br/>Port 5672/15672"]
Redis["<b>Redis</b><br/>Cache & Pub/Sub<br/>Port 6379<br/>Task Status"]
MinIO["<b>MinIO</b><br/>File Storage<br/>Port 9000/9001<br/>NIfTI & VTI Files"]
end
%% Data Flow - File Upload
User -->|"<b>1. Upload NIfTI</b>"| Browser
Browser -->|"<b>2. POST /workflow/start</b>"| Frontend
Frontend -->|"<b>3. Upload File</b>"| FastAPI
FastAPI -->|"<b>4. Save to MinIO</b>"| MinIO
FastAPI -->|"<b>5. Trigger Task</b>"| Celery
FastAPI -->|"<b>6. Store Task ID</b>"| Redis
%% Data Flow - Processing
Celery -->|"<b>7. Get Task</b>"| RabbitMQ
Celery -->|"<b>8. Load NIfTI</b>"| MinIO
Celery -->|"<b>9. Process with ONNX</b>"| Celery
Celery -->|"<b>10. Save VTI</b>"| MinIO
Celery -->|"<b>11. Update Status</b>"| Redis
%% Data Flow - Real-time Updates
Redis -->|"<b>12. SSE Events</b>"| FastAPI
FastAPI -->|"<b>13. Progress Updates</b>"| Frontend
Frontend -->|"<b>14. 3D Visualization</b>"| User
%% Styling with larger fonts and spacing
classDef clientClass fill:#e1f5fe,stroke:#01579b,stroke-width:3px,font-size:16px,font-weight:bold
classDef appClass fill:#f3e5f5,stroke:#4a148c,stroke-width:3px,font-size:16px,font-weight:bold
classDef apiClass fill:#e8f5e8,stroke:#1b5e20,stroke-width:3px,font-size:16px,font-weight:bold
classDef processingClass fill:#fff3e0,stroke:#e65100,stroke-width:3px,font-size:16px,font-weight:bold
classDef infraClass fill:#e0f2f1,stroke:#004d40,stroke-width:3px,font-size:16px,font-weight:bold
class User,Browser clientClass
class Frontend appClass
class FastAPI apiClass
class Celery processingClass
class RabbitMQ,Redis,MinIO infraClass
- User uploads NIfTI file (.nii.gz) through the React frontend interface
- Frontend sends POST request to the
/workflow/startendpoint - FastAPI validates file type and size constraints
- File is saved to MinIO storage with a unique UUID identifier
- Celery task is triggered for background processing
- Task ID is stored in Redis for progress tracking
- Celery worker retrieves the task from RabbitMQ queue
- Loads NIfTI file from MinIO storage system
- Preprocesses the volume (normalization, cropping operations)
- Executes ONNX model (SegResNet for brain tumor segmentation)
- Converts results to VTK format (.vti files)
- Saves processed files back to MinIO storage
- Updates task status in Redis for real-time monitoring
- Redis pub/sub system publishes status updates
- FastAPI SSE endpoint streams events to the frontend
- Frontend receives progress updates in real-time
- VTK.js renders 3D visualization when processing is complete
- User can download segmentation results as NIfTI files
- Technology Stack: React 19 + TypeScript + Vite
- 3D Visualization: VTK.js for medical imaging rendering
- UI Components: Radix UI + Tailwind CSS
- Key Features: File upload interface, real-time progress tracking, interactive 3D volume rendering
- Framework: FastAPI (Python)
- Port: 8001
- Core Features:
- NIfTI file upload handling (.nii.gz format)
- Server-Sent Events (SSE) for real-time progress updates
- CORS middleware for cross-origin request handling
- GZip compression for optimized data transfer
- Health check endpoints for monitoring
- Framework: Celery with RabbitMQ message broker
- AI Models: ONNX SegResNet models (128x128x128 and 208x208x144)
- Processing Tasks:
process_volume: Converts NIfTI files to NumPy arrayssegment_volume: Performs brain tumor segmentation using AIprepare_3d_data: Converts processed data to VTK format for visualization
- Storage Solution: MinIO (S3-compatible object storage)
- Supported File Types: NIfTI, VTK (.vti), NumPy (.npy)
- Key Features: Automatic file cleanup, secure file serving, persistent storage
- RabbitMQ: Task queue management and worker coordination
- Redis:
- Task result backend storage
- Pub/Sub system for real-time status updates
- Session and cache storage
- All services containerized for consistent development
- Local MinIO storage for file management
- Simplified setup for rapid development iteration
- File Upload: User uploads NIfTI file through React frontend interface
- Processing Initiation: FastAPI saves file and triggers Celery workflow
- AI Segmentation: Celery workers process files using ONNX models
- Format Conversion: Results converted to VTK format for visualization
- 3D Rendering: Frontend renders interactive 3D volumes using VTK.js
- Result Download: Users can download segmentation results as NIfTI files
- Real-time Progress Tracking: Server-Sent Events for live status updates
- Scalable Processing: Celery workers can be scaled horizontally for performance
- Medical Imaging Standards: Full support for NIfTI medical imaging format
- Interactive 3D Visualization: Advanced 3D rendering of MRI volumes
- AI-Powered Segmentation: Automated brain tumor segmentation using SegResNet
- Secure Deployment: Designed for on-premise and private cloud deployment