jrkerns / pylinac

An image analysis library for medical physics
https://pylinac.readthedocs.io/en/latest/
MIT License
153 stars 98 forks source link

Optional API to allow the usage of the 2.2.6 Wlutz algorithm #276

Open SimonBiggs opened 4 years ago

SimonBiggs commented 4 years ago

Going forward I plan to use both the Pylinac 2.2.6 Wlutz algorithm and the 3.* Wlutz algorithm in unison. To achieve this it is possible that I can do a yucky vendor (like I've done at the moment https://github.com/pymedphys/pymedphys/tree/master/pymedphys/_vendor/pylinac). But given that may not be needed any more for any case except this, might it be possible to have an optional API (maybe an optional flag to a function? Up to you) that causes the PyLinac calculation to go down the old route.

To achieve this internally myself it was quite hacky really. See:

https://github.com/pymedphys/pymedphys/blob/019ee1cf62c9a65b6de6d0f614553d7b99fdaa37/pymedphys/_vendor/pylinac/winstonlutz.py#L217-L228

https://github.com/pymedphys/pymedphys/blob/019ee1cf62c9a65b6de6d0f614553d7b99fdaa37/pymedphys/_vendor/pylinac/winstonlutz.py#L231-L278

SimonBiggs commented 4 years ago

Alternatively, to keep the API simple, you could internally run both the 2.2.6 algorithm and the 3. algorithm, have the 3. result be returned, but raise an error if they differ by more than 0.2 mm. The error should probably prompt the user to submit the data to yourself and raise an issue...

(and once again, more than happy for you to not do this, if you would rather no, I'm more than happy to implement this logic downstream within PyMedPhys)