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.