A comprehensive medical image viewer with advanced visualization capabilities for DICOM and NIfTI files - Designed for Educational and Research Purposes
Features โข Installation โข Usage โข Documentation โข Contributing
- Multi-Planar Reconstruction (MPR) - View medical images in axial, sagittal, and coronal planes
- AI Orientation Detection - Automatic detection of primary anatomical plane using ResNet18 AI model
- Dynamic View Arrangement - Views automatically arrange based on detected orientation
- Oblique Slicing - Advanced 3D rotation and oblique plane visualization
- Crosshair Navigation - Synchronized navigation across all views
- ROI Zoom - Region of interest zoom functionality
- Automatic Playback - Play/pause with speed and direction control
- DICOM Series - Full support for DICOM medical imaging files
- NIfTI Files - Support for NIfTI-1 and NIfTI-2 formats
- External Masks - Load custom segmentation masks
- Smart Orientation Detection - ResNet18 AI model automatically detects primary anatomical plane (Axial, Coronal, Sagittal)
- Confidence Scoring - AI provides confidence percentages for orientation detection
- Fallback Detection - DICOM metadata fallback when AI detection fails
- Top 3 Organ Analysis - AI identifies and ranks organs by volume for comprehensive analysis
- Intelligent View Layout - Main view automatically positioned based on detected orientation
- TotalSegmentator Integration - Automatic organ segmentation using AI
- Organ Detection - Automatic detection of lungs, heart, brain, kidneys, liver, spleen, spine, and ribcage
- Top 3 Organ Detection - AI identifies and displays the top 3 organs by volume
- Color-coded Visualization - Different colors for different organ types
- Mask Management - Load, save, and manipulate segmentation masks
- Modern GUI - Professional PyQt5-based interface
- Collapsible Sidebar - Organized, clutter-free interface
- Responsive Design - Adapts to different screen sizes
- Intuitive Controls - Easy-to-use medical imaging tools
See the following demonstrations showcasing key features of Medical MPR Viewer:
Oblique.mp4
Playback.mp4
Roi.mp4
- Python: 3.7 or higher
- Operating System: Windows, macOS, or Linux
- Memory: Minimum 4GB RAM (8GB recommended for large datasets)
- GPU: Recommended for TotalSegmentator (optional)
- PyQt5 >= 5.15.0
- NumPy >= 1.21.0
- Nibabel >= 3.2.0
- SimpleITK >= 2.1.0
- TotalSegmentator >= 1.5.0
- PyTorch >= 1.9.0 (required for AI orientation detection)
- ResNet18 Model (included in models/ directory)
# Clone the repository
git clone https://github.com/youssefh4/MPR-viewer.git
cd MPR-viewer
# Install dependencies
pip install -r requirements.txt
# Run the application
python run_viewer.py# Install specific dependencies
pip install PyQt5 numpy nibabel SimpleITK totalsegmentator
# Optional: Install PyTorch for enhanced features
pip install torch torchvision-
Launch the Application:
python run_viewer.py
-
Load Medical Images:
- Click "Load DICOM Series" or "Load NIfTI File"
- Navigate to your medical imaging data
- Select the folder/file to load
- AI will automatically detect orientation and arrange views accordingly
-
Navigate Images:
- Use mouse wheel to scroll through slices
- Click and drag to pan
- Use crosshairs to navigate between views
-
Run Segmentation (Optional):
- Click "Run TotalSegmentator" in the sidebar
- Wait for AI processing to complete
- View segmented organs with color coding
- AI will display the top 3 detected organs by volume
- Oblique Slicing: Use rotation controls for 3D visualization
- Playback: Enable automatic slice playback with speed control
- ROI Zoom: Select regions of interest for detailed examination
- External Masks: Load custom segmentation results
MPR-viewer/
โโโ src/ # Source code
โ โโโ mpr_viewer.py # Main application
โ โโโ data_loader.py # Data loading utilities
โ โโโ segmentation.py # Segmentation management
โ โโโ ui_components.py # UI components
โ โโโ utils.py # Utility functions
โ โโโ config.py # Configuration settings
โ โโโ __init__.py # Package initialization
โโโ models/ # Model files
โ โโโ resnet18_orientation_finetuned.pth
โโโ data/ # Data directory
โ โโโ totalsegmentator_output/ # Segmentation outputs
โโโ run_viewer.py # Main launcher script
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ .gitignore # Git ignore rules
The application can be configured through src/config.py:
- Organ Colors: Customize colors for different organ types
- Organ Groups: Define organ groupings for segmentation (including ribcage support)
- Default Settings: Window size, playback speed, output directories
- AI Model: ResNet18 orientation detection model path and settings
DICOM_MPR_Viewer: Main application classDataLoader: Handles medical image loadingSegmentationManager: Manages AI segmentationCollapsibleBox: UI component for organized interface
# Basic usage
from src.mpr_viewer import DICOM_MPR_Viewer
from PyQt5.QtWidgets import QApplication
app = QApplication([])
viewer = DICOM_MPR_Viewer()
viewer.show()
app.exec_()We welcome contributions! Please see our Contributing Guidelines for details.
# Clone the repository
git clone https://github.com/youssefh4/MPR-viewer.git
cd MPR-viewer
# Install development dependencies
pip install -r requirements.txt
# Run the application
python run_viewer.pyThis software is designed for educational and research purposes in medical imaging.
- Learn medical image processing and visualization
- Teach medical imaging concepts in classrooms
- Research academic projects in medical imaging
- Practice with DICOM and NIfTI files
- Study AI applications in medical imaging
- Use for clinical diagnosis or medical treatment
- Use commercially without permission
- Redistribute for commercial gain
Note: This software is for learning only, not for clinical use.
This project is licensed under the Educational License - see the LICENSE file for details.
Educational Use Only: This software is intended for educational and research purposes. Commercial use requires separate licensing.
- TotalSegmentator - For providing excellent organ segmentation capabilities
- PyQt5 - For the robust GUI framework
- SimpleITK - For medical image processing
- Nibabel - For NIfTI file support
- Issues: Report bugs and request features on GitHub Issues
- Web-based viewer using Streamlit
- Additional segmentation models
- 3D volume rendering
- Plugin system for extensions
- Cloud deployment support
- Mobile app companion
Made with โค๏ธ for the medical imaging community
โญ Star this repo โข ๐ Report Bug โข [๐ก Request Feature](https://github.com/youssefh4/MPR-viewer/i[...]

