Skip to content

MiRL-IITM/cbct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dental CBCT Simulation & Visualization

Monte Carlo simulation of cone-beam CT (CBCT) projections using OpenGATE 10.x.

📋 Overview

This project simulates a dental CBCT scan by:

  1. Creating an acrylic cylinder phantom with embedded ball bearing markers (BBs) arranged in a precise 3-plane pattern
  2. Rotating the phantom through 360° while keeping source and detector fixed
  3. Generating projection images at each angle using Monte Carlo particle transport
  4. Providing interactive visualization tools to analyze the projection data

Key Features:

  • Realistic physics simulation using Geant4 via OpenGATE
  • Customizable phantom geometry and materials
  • Multiple visualization modes (2D/3D, interactive/static)
  • Automatic saving of all plots for publication
  • Jupyter notebook interface for interactive exploration

🚀 Quick Start

1. Installation

# Clone or download this repository
cd cbct/

# Install dependencies
pip install -r requirements.txt

2. Run the Simulation

python simulation.py

This will:

  • Generate 12 projections (default, adjustable in code)
  • Save individual projections and combined stack to output/
  • Typical runtime: varies with particles_per_proj (default: 5 billion photons/projection)

Output files:

output/
├── projections_counts.mhd     # Combined projection stack (1504 × 1248, uint16)
├── projections_counts.raw     # Binary data
├── proj_single_counts.mhd     # Last single projection
└── *.root                     # ROOT files (hits, singles)

3. Visualize Results

Command-line interactive menu:

python visualize.py

Select from 9 visualization modes:

  • 1-4: 2D views (slice browser, montage, sinogram, statistics)
  • 5-9: 3D views (orthogonal slices, surface plots, volume rendering)

Jupyter notebook (interactive slider):

jupyter notebook slice_browser.ipynb

All plots are auto-saved to output/plots/ as PNG (600 dpi) or HTML (Plotly).


📂 Project Structure

cbct/
├── simulation.py          # Monte Carlo CBCT simulation (OpenGATE)
├── visualize.py           # Visualization suite (matplotlib + plotly)
├── slice_browser.ipynb    # Interactive Jupyter notebook
├── requirements.txt       # Python dependencies
├── README.md              # This file
└── output/                # Generated data and plots
    ├── projections_counts.mhd
    └── plots/             # Auto-saved visualizations
        ├── projection_montage.png
        ├── sinogram.png
        ├── 3d_isosurface.html
        └── ...

🔧 Simulation Parameters

Adjust these in simulation.py (lines 18-27):

Parameter Default Description
num_projections 12 Number of projection angles (0-360°)
particles_per_proj 5,000,000,000 Photons simulated per projection
energy_keV 75 X-ray energy (monoenergetic approximation)
pixel_count_u × pixel_count_v 1504 × 1248 Detector pixels (Binning 2×2 mode)
pixel_spacing_mm 0.2 Effective pixel spacing (200 µm)
detector_width_mm × height_mm 300.8 × 249.6 Physical active area
SID_mm 480 Source-to-isocenter distance
SDD_mm 700 Source-to-detector distance

Detector & Hardware:

  • Detector: Mercu1012X CsI flat-panel (300.8 × 249.6 mm, 100 µm native pixels)
  • Source: RADII KL3SB-0.5-130 / Gemini012 gantry (0.5 mm focal spot)
  • Matrix mode: Binning 2×2 → 1504 × 1248 @ 0.2 mm spacing
  • CsI thickness: 700 µm scintillator

Phantom anatomy:

  • Acrylic cylinder (57–60 mm inner/outer radius, 27.5 mm height)
  • 27 regular ball bearings (1.5 mm dia., stainless steel) arranged in 3 horizontal planes at y = 22.5, −2.5, −22.5 mm
    • Top plane: 12 BBs at 30° intervals; 1 marker at θ=0°
    • Middle plane: 12 BBs at 30° intervals; 1 marker at θ=180°
    • Bottom plane: 6 BBs at 60° intervals; 1 marker at θ=0°
  • 3 marker ball bearings (2.5 mm dia., stainless steel) at specific angles for geometry verification

Physics: G4EmStandardPhysics_option4 with 1 mm production cuts


🔬 Technical Details

Monte Carlo Simulation

  • Engine: Geant4 10.x via OpenGATE
  • Particle transport: Photons (gamma) with full EM physics
  • Geometry: Constructive solid geometry (CSG) volumes
  • Materials: NIST database (G4_WATER, G4_BONE_CORTICAL_ICRP, etc.)
  • Detector: CsI scintillator, energy-weighted digitizer

Data Format

  • Image format: MetaImage (.mhd/.raw) - universally readable
  • Array shape: (n_proj, ny, nx) = (12, 1248, 1504) with default settings
  • Data type: uint16 (16-bit unsigned, 0–65535 counts, matching detector ADC)
  • Pixel spacing: 0.2 mm (200 µm) native / 0.4 mm (400 µm) binned
  • Value units: Photon counts per pixel (energy-weighted digitizer)

Coordinate System

  • Z-axis: Source-detector axis (source at −480 mm, isocenter at 0, detector at +220 mm)
  • Y-axis: Vertical axis (phantom cylinder axis after tilting)
  • Rotation: Phantom rotates around Y-axis per projection angle
  • Detector: Fixed 2D flat panel perpendicular to Z-axis

About

Monte Carlo simulation of cone-beam CT (CBCT) projections using OpenGATE 10.x.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors