Python Script: Detect Small Treatment Apertures from DICOM RTPLAN
DICOM RTPLAN Small Field Detector (Python)
Build practical DICOM engineering skills with this educational Python script.
This tool analyzes a DICOM RTPLAN file and automatically detects control points that contain very small treatment apertures.
Instead of relying on a treatment planning system, all calculations are derived directly from DICOM metadata.
The script reconstructs aperture geometry using MLC positions, leaf boundaries, and jaw positions.
It then generates warnings whenever a control point falls below a user-defined threshold.
What the script calculates
For every beam and every control point:
✅ Average MLC opening
✅ Aperture span using active leaf widths
✅ Jaw span (if available)
✅ Automatic warning generation for small apertures