Skip to content

MahmoudMazen0/MPR-Viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 MPR Neural Viewer

Python PyQt5 License Platform

Advanced Multi-Planar Reconstruction System for Medical Imaging

FeaturesInstallationUsageArchitectureScreenshots


✨ Features

Feature Description
📁 Multi-Format Support Load DICOM series, NIfTI (.nii, .nii.gz), and NumPy (.npy) volumes
🔄 Multi-Planar Views Axial, Sagittal, Coronal, and Oblique reconstructions
🎯 Interactive Navigation Click to recenter, scroll to slice, drag to pan
🔍 Zoom Controls Ctrl+scroll or buttons for precise zoom
📐 Oblique Slicing Drag yellow handles to rotate the cutting plane
🤖 AI Organ Detection TotalSegmentator integration for automatic organ segmentation
📊 Contour Mode Visualize segmentation contours with label selection
🎬 Cine Playback Animate through slices in any view
💾 Export Options Save slices (PNG/NPY) or ROI volumes (NIfTI/NPY)
🌙 Cyberpunk Theme Modern dark UI with neon accents

📦 Installation

Prerequisites

# Required
pip install PyQt5 numpy matplotlib scipy

# Optional (for full functionality)
pip install pydicom          # DICOM support
pip install nibabel          # NIfTI support
pip install scikit-image     # Contour detection
pip install totalsegmentator # AI organ detection (requires GPU)

Quick Start

# Clone or download the project
cd d:\study\imaging\tasks\task2

# Run the application
python main.py

🚀 Usage

Loading Data

  1. DICOM: Click "Load DICOM" → Select folder containing DICOM files
  2. NIfTI/NumPy: Click "Load NIfTI/NumPy" → Select .nii, .nii.gz, or .npy file

Navigation

Action Control
Change slice Scroll wheel or slider
Recenter views Click on any view
Pan Drag with left mouse button
Zoom Ctrl + scroll wheel
Rotate oblique plane Drag yellow handles on crosshair

AI Features

  • Detect Organ: Runs TotalSegmentator to identify the main organ
  • Run AI: Detects volume orientation (Axial/Sagittal/Coronal)

Contour Mode

  1. Load segmentation file with "Load Seg (Contour)"
  2. Select label from dropdown
  3. Click "Enter Contour Mode"
  4. Navigate through contour slices

🏗️ Architecture

MPR-Viewer/
├── main.py                 # Application entry point
├── config/
│   ├── __init__.py
│   └── theme.py            # Dark theme stylesheet & palette
├── core/
│   ├── __init__.py
│   ├── reslice.py          # Oblique slice interpolation
│   └── segmentation.py     # TotalSegmentator thread
├── ui/
│   ├── __init__.py
│   ├── view_panel.py       # Single view panel container
│   ├── info_dialog.py      # Startup splash dialog
│   └── main_window.py      # Main MPRApp window
└── utils/
    ├── __init__.py
    └── math_utils.py       # Rotation matrices & plane calculations

Module Responsibilities

Module Purpose
config.theme CSS styling and color palette
core.reslice 3D volume oblique resampling
core.segmentation Background AI segmentation
ui.view_panel Matplotlib canvas + slider + crosshair state
ui.info_dialog Animated startup screen
ui.main_window All UI logic, events, and rendering
utils.math_utils 3D rotation and plane normal calculations

📸 Screenshots

Main Interface

The application features a 2×2 grid layout with:

  • Top-left: Axial view
  • Top-right: Sagittal view
  • Bottom-left: Coronal view
  • Bottom-right: Oblique view (interactive)

Cyberpunk Theme

  • Dark background (#0a0f1a)
  • Neon cyan accents (#00ffcc)
  • Terminal-style fonts (Consolas)
  • Glowing button effects

⚙️ Technical Details

Volume Coordinate System

  • Shape: (Z, Y, X) or (Slices, Rows, Columns)
  • Axial: vol[:, :, z] - horizontal slices
  • Sagittal: vol[x, :, :] - left-right slices
  • Coronal: vol[:, y, :] - front-back slices

Oblique Slicing Algorithm

Uses trilinear interpolation via scipy.ndimage.map_coordinates:

  1. Compute plane normal from crosshair rotation angles
  2. Build orthonormal basis (u, v, n)
  3. Sample points on the plane grid
  4. Interpolate volume values

📄 License

MIT License - Feel free to use and modify for your projects.


🤝 Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.


Made with ❤️ for Medical Imaging

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages