Skip to content

Latest commit

 

History

History
198 lines (156 loc) · 7.04 KB

README.md

File metadata and controls

198 lines (156 loc) · 7.04 KB

Proton Beam Therapy Simulator

Table of Contents

  1. Project Overview

  2. Technical Documentation

Project Overview

Context

Proton beam therapy represents a promising frontier in oncological treatment, offering advantages over conventional radiotherapy modalities. The ability of protons to deposit most of their energy at the Bragg peak allows for concentrated radiation dose delivery to tumors while minimizing exposure to surrounding healthy tissues. This characteristic is particularly advantageous for tumors located near vital organs and in pediatric treatments.

However, widespread adoption of proton therapy faces technical and economic challenges, including high infrastructure costs and the need for extreme precision in beam targeting. This project addresses these challenges through an innovative approach of rotating the patient instead of the beam, potentially reducing operational costs and increasing treatment accessibility.

Physical Implementation

Below are images of the actual device implementation:

Device with calibration plate Device with tumor
Device setup with calibration plate Device setup with tumor model

The device consists of a goniometer placed between two cameras, with a laser system controlled by mirrors for beam targeting. The setup allows for precise calibration and tumor targeting through controlled rotations and beam positioning.

System Architecture

System diagram

The simulator consists of several key components:

  • Goniometer: Simulates patient chair rotation, positioned between two cameras
  • Cameras:
    • Camera A: Acts as a tomograph, capturing tumor images at various angles
    • Camera B: Handles laser calibration and position verification
  • Laser System:
    • Controlled via MCP board
    • Directed by two mirrors (X and Y axes)
    • Powered by FAST-PS sources
  • Control Software: Manages calibration, imaging, and beam targeting

Implementation Details

1. Calibration Process

The calibration involves multiple steps:

  • Alignment of calibration plate with Camera A
  • 89-degree rotation for laser calibration
  • Manual and fine-tuned laser positioning
  • Centroid detection for precise targeting

2. Tomographic Imaging

  • Captures 360 tumor images at 1-degree intervals
  • Generates 3D tumor model from silhouettes
  • Converts pixel coordinates to cylindrical coordinates for processing

3D Model View 1 3D Model View 2 3D Model View 3 3D Model View 4

Different views of the generated 3D tumor model

3. Irradiation Process

  • Establishes voltage-to-pixel correspondence through linear interpolation
  • Segments tumor model into slices for depth simulation
  • Rotates coordinate system to match physical tumor position
  • Controls laser targeting based on transformed coordinates

Results

The project achieved its primary objectives:

  1. Successfully developed robust software for proton irradiation simulation
  2. Implemented precise calibration modules
  3. Created accurate 3D tumor modeling
  4. Demonstrated effective beam targeting across multiple angles and depths

Areas identified for future improvement include:

  • Enhanced calibration precision
  • Refined depth simulation techniques
  • Improved voltage parameter interpolation methods

Technical Documentation

Software Architecture

The system comprises 12 core modules:

Calibration Modules

  1. Goniometer.py

    • Manages goniometer movement and communication
    • Handles serial communication and angle positioning
    • Integrates with imaging system for tomography
  2. Painter.py

    • Controls laser movement and calibration
    • Manages beam targeting and tumor irradiation
    • Implements calibration routines
  3. Image_processor.py

    • Processes captured images
    • Detects contours and centroids
    • Handles tumor identification

Auxiliary Modules

  1. Socket_connection.py

    • Manages network communications
    • Handles device connectivity
  2. Laser.py

    • Controls laser operation via MCP2210
    • Manages beam activation timing
  3. Camera.py

    • Interfaces with imaging devices
    • Handles image capture and storage
  4. Mcp.py

    • Configures USB-to-SPI bridge
    • Manages hardware communication

Core Processing Modules

  1. Model_generator.py

    • Converts 2D silhouettes to 3D models
    • Handles coordinate transformations
  2. Tumour.py

    • Represents tumor in 3D space
    • Manages rotations and transformations

Execution Modules

  1. Run.py

    • Main execution orchestrator
    • Manages simulation workflow
  2. Function_chain.py

    • Implements linked list of execution functions
    • Controls program flow

Usage Instructions

  1. System Setup
# Clone the repository
git clone https://github.com/andre-meneses/simulador-cnpem

# Install dependencies (ensure Python 3.x is installed)
pip install -r requirements.txt
  1. Running the Simulation
python3 Run.py <argument>

Available arguments:

  • calibrate: Start from calibration phase
  • tomography: Begin with tomographic imaging
  • generate-model: Start from model generation
  • burn-tumour: Execute only tumor irradiation
  1. Configuration
  • Modify config/config.yaml for system parameters
  • Adjust calibration settings in respective modules

Key Dependencies

  • OpenCV: Image processing
  • NumPy: Numerical computations
  • PyVista: 3D visualization
  • Matplotlib: Data visualization
  • scikit-learn: Data analysis

Development Notes

  • Follow modular design principles
  • Maintain separation of concerns
  • Document new features and changes
  • Test thoroughly before integration