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.
Below are images of the actual device implementation:
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.
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
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
- Captures 360 tumor images at 1-degree intervals
- Generates 3D tumor model from silhouettes
- Converts pixel coordinates to cylindrical coordinates for processing
Different views of the generated 3D tumor model
- 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
The project achieved its primary objectives:
- Successfully developed robust software for proton irradiation simulation
- Implemented precise calibration modules
- Created accurate 3D tumor modeling
- 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
The system comprises 12 core modules:
-
Goniometer.py
- Manages goniometer movement and communication
- Handles serial communication and angle positioning
- Integrates with imaging system for tomography
-
Painter.py
- Controls laser movement and calibration
- Manages beam targeting and tumor irradiation
- Implements calibration routines
-
Image_processor.py
- Processes captured images
- Detects contours and centroids
- Handles tumor identification
-
Socket_connection.py
- Manages network communications
- Handles device connectivity
-
Laser.py
- Controls laser operation via MCP2210
- Manages beam activation timing
-
Camera.py
- Interfaces with imaging devices
- Handles image capture and storage
-
Mcp.py
- Configures USB-to-SPI bridge
- Manages hardware communication
-
Model_generator.py
- Converts 2D silhouettes to 3D models
- Handles coordinate transformations
-
Tumour.py
- Represents tumor in 3D space
- Manages rotations and transformations
-
Run.py
- Main execution orchestrator
- Manages simulation workflow
-
Function_chain.py
- Implements linked list of execution functions
- Controls program flow
- 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
- Running the Simulation
python3 Run.py <argument>
Available arguments:
calibrate
: Start from calibration phasetomography
: Begin with tomographic imaginggenerate-model
: Start from model generationburn-tumour
: Execute only tumor irradiation
- Configuration
- Modify
config/config.yaml
for system parameters - Adjust calibration settings in respective modules
- OpenCV: Image processing
- NumPy: Numerical computations
- PyVista: 3D visualization
- Matplotlib: Data visualization
- scikit-learn: Data analysis
- Follow modular design principles
- Maintain separation of concerns
- Document new features and changes
- Test thoroughly before integration