$ show jrkerns/pylinac
pylinac is a Python library for performing TG-142 QA tasks on linear accelerators. It provides high-level analysis modules for common radiotherapy QA testsβVMAT, Winston-Lutz, PIPS, field analysis, planar imaging, log analysis, CT, and star shotβplus lower-level core modules for image handling, gamma analysis, ROI calculations, and structured results. The library is used as a dependency in clinical QA workflows and exposes a consistent API: instantiate an analysis class with a DICOM/log file path, call `.analyze(...)`, then access `.results_data()`, `.publish_pdf()`, or `.plot_analyzed_image()`.
The LLM identified 3 files worth highlighting for reuse:
Implements gamma index calculation for 2D dose distribution comparison using the standard distance-to-agreement and dose-difference criteria. The core numerical routine is self-contained and can be extracted for any radiotherapy dose comparison tool. Known limitation: it does not perform size/spatial resolution checking, so callers must validate inputs separately.
Provides a synthetic DICOM image generation framework with Simulator and Layer classes. It is used by the test suite to create realistic linac images with known ground truth, making it reusable for generating synthetic QA images in other medical physics projects or for testing image-processing pipelines.
Contains the ResultsDataMixin and ResultBase base classes that standardize structured analysis results, JSON serialization, PDF publishing, and plotting hooks. This pattern is reusable across any analysis library that needs consistent result objects and serialization behavior.