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.