Winston-Lutz Offset Analyzer (Python Script + Visual Overlay)
🔍 Quickly verify BB-to-field alignment in radiation therapy QA images.
This Python-based tool automates Winston-Lutz analysis by:
- Reading a DICOM image from EPID or portal imaging systems
- Detecting the ball bearing (BB) with subpixel precision using a 2D Gaussian fit
- Identifying the radiation field center via thresholded contour detection
- Calculating offset in millimeters using IEC 61217 U–V convention
- Generating annotated overlay images (BB, field center, field box)
âś… Output includes:
- dU (gun–target direction)
- dV (left–right direction)
- Total 2D offset
- Overlay PNG for easy review
⚙️ Requirements: Python 3.7+ with OpenCV, SciPy, NumPy, and pydicom
đź§Ş Tested with 1600 mm SID images, 0.251 mm pixel size (modifiable)
🎓 Ideal for medical physicists, dosimetrists, and QA engineers who want a clean, transparent alternative to commercial tools — or just want to understand what’s happening behind the scenes.