pylinac 0.6.0.1__zip → 1.5.0__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. {pylinac-0.6.0.1 → pylinac-1.5.0}/MANIFEST.in +0 -0
  2. {pylinac-0.6.0.1 → pylinac-1.5.0}/PKG-INFO +2 -2
  3. pylinac-1.5.0/README.rst +252 -0
  4. pylinac-1.5.0/pylinac/__init__.py +17 -0
  5. pylinac-1.5.0/pylinac/cbct.py +1415 -0
  6. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/core/__init__.py +0 -0
  7. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/core/decorators.py +9 -57
  8. pylinac-1.5.0/pylinac/core/geometry.py +365 -0
  9. pylinac-1.5.0/pylinac/core/image.py +862 -0
  10. pylinac-1.5.0/pylinac/core/io.py +41 -0
  11. pylinac-1.5.0/pylinac/core/mask.py +73 -0
  12. pylinac-1.5.0/pylinac/core/profile.py +1045 -0
  13. pylinac-1.5.0/pylinac/core/roi.py +186 -0
  14. pylinac-1.5.0/pylinac/core/utilities.py +103 -0
  15. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/cbct/High quality head.zip +0 -0
  16. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/flatsym/flatsym_demo.dcm +0 -0
  17. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/log_reader/AQA.dlg +0 -0
  18. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/log_reader/BQA.dlg +0 -0
  19. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/log_reader/Tlog.bin +0 -0
  20. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/demo_files/picket_fence/EPID-PF-LR.dcm +0 -0
  21. pylinac-1.5.0/pylinac/demo_files/planar_imaging/leeds.dcm +0 -0
  22. pylinac-1.5.0/pylinac/demo_files/planar_imaging/pipspro.dcm +0 -0
  23. pylinac-0.6.0.1/pylinac/demo_files/starshot/10X_collimator.tif → pylinac-1.5.0/pylinac/demo_files/starshot/starshot.tif +0 -0
  24. pylinac-1.5.0/pylinac/demo_files/vmat/drgs.zip +0 -0
  25. pylinac-1.5.0/pylinac/demo_files/vmat/drmlc.zip +0 -0
  26. pylinac-1.5.0/pylinac/demo_files/winston_lutz/winston_lutz.zip +0 -0
  27. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/flatsym.py +64 -89
  28. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac/log_analyzer.py +779 -469
  29. pylinac-1.5.0/pylinac/picketfence.py +861 -0
  30. pylinac-1.5.0/pylinac/planar_imaging.py +591 -0
  31. pylinac-1.5.0/pylinac/scripts.py +42 -0
  32. pylinac-1.5.0/pylinac/starshot.py +535 -0
  33. pylinac-1.5.0/pylinac/vmat.py +534 -0
  34. pylinac-1.5.0/pylinac/watcher.py +348 -0
  35. pylinac-1.5.0/pylinac/watcher_config.yml +107 -0
  36. pylinac-1.5.0/pylinac/winston_lutz.py +595 -0
  37. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac.egg-info/PKG-INFO +2 -2
  38. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac.egg-info/SOURCES.txt +14 -7
  39. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac.egg-info/dependency_links.txt +0 -0
  40. pylinac-1.5.0/pylinac.egg-info/entry_points.txt +3 -0
  41. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac.egg-info/not-zip-safe +0 -0
  42. pylinac-1.5.0/pylinac.egg-info/requires.txt +15 -0
  43. {pylinac-0.6.0.1 → pylinac-1.5.0}/pylinac.egg-info/top_level.txt +0 -0
  44. {pylinac-0.6.0.1 → pylinac-1.5.0}/setup.cfg +1 -1
  45. {pylinac-0.6.0.1 → pylinac-1.5.0}/setup.py +19 -12
  46. pylinac-0.6.0.1/README.rst +0 -59
  47. pylinac-0.6.0.1/pylinac/__init__.py +0 -14
  48. pylinac-0.6.0.1/pylinac/cbct.py +0 -1202
  49. pylinac-0.6.0.1/pylinac/core/common_functions.py +0 -178
  50. pylinac-0.6.0.1/pylinac/core/geometry.py +0 -366
  51. pylinac-0.6.0.1/pylinac/core/image.py +0 -359
  52. pylinac-0.6.0.1/pylinac/core/io.py +0 -98
  53. pylinac-0.6.0.1/pylinac/core/profile.py +0 -604
  54. pylinac-0.6.0.1/pylinac/core/utilities.py +0 -106
  55. pylinac-0.6.0.1/pylinac/demo_files/log_reader/Tlog2.bin +0 -0
  56. pylinac-0.6.0.1/pylinac/demo_files/vmat/DRGS_dmlc.dcm +0 -0
  57. pylinac-0.6.0.1/pylinac/demo_files/vmat/DRGS_open.dcm +0 -0
  58. pylinac-0.6.0.1/pylinac/demo_files/vmat/DRMLC_dmlc.dcm +0 -0
  59. pylinac-0.6.0.1/pylinac/demo_files/vmat/DRMLC_open.dcm +0 -0
  60. pylinac-0.6.0.1/pylinac/picketfence.py +0 -566
  61. pylinac-0.6.0.1/pylinac/starshot.py +0 -568
  62. pylinac-0.6.0.1/pylinac/vmat.py +0 -437
  63. pylinac-0.6.0.1/pylinac.egg-info/requires.txt +0 -5
File without changes
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pylinac
3
- Version: 0.6.0.1
3
+ Version: 1.5.0
4
4
  Summary: A toolkit for performing TG-142 QA-related tasks on a linear accelerator
5
5
  Home-page: https://github.com/jrkerns/pylinac
6
6
  Author: James Kerns
7
7
  Author-email: jkerns100@gmail.com
8
- License: UNKNOWN
8
+ License: MIT
9
9
  Description: UNKNOWN
10
10
  Keywords: medical physics AAPM TG142 quality assurance starshot cbct vmat dynalog trajectory log
11
11
  Platform: UNKNOWN
@@ -0,0 +1,252 @@
1
+ Pylinac
2
+ =======
3
+
4
+ .. image:: https://badges.gitter.im/Join%20Chat.svg
5
+ :alt: Join the chat at https://gitter.im/jrkerns/pylinac
6
+ :target: https://gitter.im/jrkerns/pylinac?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
7
+
8
+ .. image:: https://img.shields.io/pypi/v/pylinac.svg
9
+ :target: https://pypi.python.org/pypi/pylinac
10
+ :alt: Latest Version
11
+
12
+ .. image:: https://anaconda.org/jrkerns/pylinac/badges/installer/conda.svg
13
+ :target: https://anaconda.org/jrkerns/pylinac
14
+
15
+ .. image:: https://img.shields.io/pypi/l/pylinac.svg
16
+ :target: https://pypi.python.org/pypi/pylinac/
17
+ :alt: MIT
18
+
19
+ .. image:: https://travis-ci.org/jrkerns/pylinac.svg?branch=master
20
+ :target: https://travis-ci.org/jrkerns/pylinac
21
+ :alt: Travis CI
22
+
23
+ .. image:: https://coveralls.io/repos/jrkerns/pylinac/badge.svg?branch=master
24
+ :target: https://coveralls.io/r/jrkerns/pylinac
25
+ :alt: Code Coverage
26
+
27
+ .. image:: https://www.quantifiedcode.com/api/v1/project/25e3cefc2cc84052bbd127c3386adf69/badge.svg
28
+ :target: https://www.quantifiedcode.com/app/project/25e3cefc2cc84052bbd127c3386adf69
29
+ :alt: Code issues
30
+
31
+ .. image:: https://readthedocs.org/projects/pylinac/badge/?version=stable
32
+ :target: http://pylinac.readthedocs.org/en/stable/?badge=stable
33
+ :alt: Documentation Status
34
+
35
+
36
+ Pylinac provides TG-142 quality assurance (QA) tools to Python programmers as well as non-programmers in the field of
37
+ therapy medical physics. The package comes in two flavors: source-level and `web app <https://assuranceqa.herokuapp.com>`_. The source-level
38
+ allows programmers and those familiar with Python to create custom tests with pylinac while the web app is for
39
+ those who don't want or don't know how to program.
40
+
41
+ Pylinac contains high-level modules for automatically analyzing images and data generated by linear accelerators.
42
+ Most scripts can be utilized with <10 lines of code.
43
+
44
+ The library also contains lower-level `hackable modules & tools <http://pylinac.readthedocs.org/en/latest/pylinac_core_hacking.html>`_
45
+ for creating your own radiation therapy algorithms.
46
+
47
+ Below are the high-level tools currently available:
48
+
49
+ * `Continuous Directory Watching <http://pylinac.readthedocs.org/en/stable/watcher.html>`_ -
50
+ True, one-time "set it and forget it" service that analyzes any file that enters the folder. Files with
51
+ keywords and certain file types are analyzed automatically.
52
+ Only two lines of code: 1) install, 2) run::
53
+
54
+ $ pip install pylinac
55
+ $ pylinac watch "dir/to/watch"
56
+
57
+ And that's it! No code to write; no fuss, no muss.
58
+ Analysis settings are customizable and includes optional email service upon analysis.
59
+
60
+ * `Planar Phantom Analysis (Leeds TOR, PipsPro QC-3) <http://pylinac.readthedocs.org/en/stable/planar_imaging.html>`_ -
61
+ The planar imaging module analyzes 2D phantoms. Currently only the LeedsTOR kV phantom and PipsPro QC-3 MV phantom.
62
+
63
+ Features:
64
+
65
+ * **Automatic phantom localization** - Set up your phantom any way you like; automatic positioning,
66
+ angle, and inversion correction mean you can set up how you like, nor will setup variations give you headache.
67
+ * **High and low contrast determination** - Analyze both low and high contrast ROIs. Set thresholds
68
+ as you see fit.
69
+
70
+ Example script::
71
+
72
+ from pylinac import LeedsTOR, PipsProQC3
73
+
74
+ path = 'path/to/leeds.dcm`
75
+ leeds = LeedsTOR(path)
76
+ leeds.analyze()
77
+ leeds.plot_analyzed_image()
78
+
79
+ path = 'path/to/pipspro.dcm'
80
+ pp = PipsProQC3(path)
81
+ pp.analyze()
82
+ pp.plot_analyzed_image()
83
+
84
+ * `Winston-Lutz Analysis <http://pylinac.readthedocs.org/en/stable/winston_lutz.html>`_ -
85
+ The Winston-Lutz module analyzes EPID images taken of a small radiation field and BB to determine the 2D
86
+ distance from BB to field CAX. Additionally, the isocenter size of the gantry, collimator, and couch can
87
+ all be determined *without the BB being at isocenter*. Analysis is based on
88
+ `Winkler et al <http://iopscience.iop.org/article/10.1088/0031-9155/48/9/303/meta;jsessionid=269700F201744D2EAB897C14D1F4E7B3.c2.iopscience.cld.iop.org>`_
89
+ and `Du et al <http://scitation.aip.org/content/aapm/journal/medphys/37/5/10.1118/1.3397452>`_.
90
+
91
+ Features:
92
+
93
+ * **Automatic field & BB positioning** - When an image or directory is loaded, the field CAX and the BB
94
+ are automatically found, along with the vector and scalar distance between them.
95
+ * **Isocenter size determination** - Using backprojections of the EPID images, the 3D gantry isocenter size
96
+ and position can be determined *independent of the BB position*. Additionally, the 2D planar isocenter size
97
+ of the collimator and couch can also be determined.
98
+ * **Image plotting** - WL images can be plotted separately or together, each of which shows the field CAX, BB and
99
+ scalar distance from BB to CAX.
100
+ * **Gantry sag** - The sag of the gantry is also quantified and can be plotted.
101
+
102
+ Example script::
103
+
104
+ from pylinac import WinstonLutz
105
+
106
+ path = 'path/to/image/directory`
107
+ wl = WinstonLutz(path) # images are analyzed upon loading
108
+ wl.plot_summary()
109
+ print(wl.results())
110
+
111
+ * `Starshot Analysis <http://pylinac.readthedocs.org/en/stable/starshot_docs.html>`_ -
112
+ The Starshot module analyses a starshot image made of radiation spokes, whether gantry, collimator, MLC or couch.
113
+ It is based on ideas from `Depuydt et al <http://iopscience.iop.org/0031-9155/57/10/2997>`_
114
+ and `Gonzalez et al <http://dx.doi.org/10.1118/1.1755491>`_.
115
+
116
+ Features:
117
+
118
+ * **Analyze scanned film images, single EPID images, or a set of EPID images** -
119
+ Any image that you can load in can be analyzed, including 1 or a set of EPID DICOM images and
120
+ films that have been digitally scanned.
121
+ * **Any image size** - Have machines with different EPIDs? Scanned your film at different resolutions? No problem.
122
+ * **Dose/OD can be inverted** - Whether your device/image views dose as an increase in value or a decrease, pylinac
123
+ will detect it and invert if necessary.
124
+ * **Automatic noise detection & correction** - Sometimes there's dirt on the scanned film; sometimes there's a dead pixel on the EPID.
125
+ Pylinac will detect these spurious noise signals and can avoid or account for them.
126
+ * **Accurate, FWHM star line detection** - Pylinac uses not simply the maximum value to find the center of a star line,
127
+ but analyzes the entire star profile to determine the center of the FWHM, ensuring small noise or maximum value bias is avoided.
128
+ * **Adaptive searching** - If you passed pylinac a set of parameters and a good result wasn't found, pylinac can recover and
129
+ do an adaptive search by adjusting parameters to find a "reasonable" wobble.
130
+
131
+ Example script::
132
+
133
+ from pylinac import Starshot
134
+
135
+ star = Starshot("mystarshot.tif")
136
+ star.analyze(radius=60, tolerance=0.75)
137
+ print(star.return_results()) # prints out wobble information
138
+ star.plot_analyzed_image() # shows a matplotlib figure
139
+
140
+ * `VMAT QA <http://pylinac.readthedocs.org/en/stable/vmat_docs.html>`_ -
141
+ The VMAT module consists of the class VMAT, which is capable of loading an EPID DICOM Open field image and MLC field image and analyzing the
142
+ images according to the Varian RapidArc QA tests and procedures, specifically the Dose-Rate & Gantry-Speed (DRGS) and MLC speed (MLCS) tests.
143
+
144
+ Features:
145
+
146
+ * **Do both tests** - Pylinac can handle either DRGS or DRMLC tests.
147
+ * **Adjust for offsets** - Older VMAT patterns were off-center. Easily account for the offset by passing it in.
148
+ * **Automatic identification using file names** - If your file names are clear, the image type and test type don't even
149
+ have to be specified; just load and analyze.
150
+
151
+ Example script::
152
+
153
+ from pylinac import VMAT
154
+
155
+ vmat = VMAT.from_zip("myvmatimages.zip")
156
+ vmat.analyze(test='mlcs', tolerance=1.5)
157
+ print(vmat.return_results()) # prints out ROI information
158
+ vmat.plot_analyzed_image() # shows a matplotlib figure
159
+
160
+ * `CT & CBCT QA <http://pylinac.readthedocs.org/en/stable/cbct_docs.html>`_ -
161
+ The CBCT module automatically analyzes DICOM images of a CatPhan 504 or 503 acquired when doing CBCT or regular CT quality assurance. It can load a folder or zip file that
162
+ the images are in and automatically correct for phantom setup in 6 degrees.
163
+ It can analyze the HU regions and image scaling (CTP404), the high-contrast line pairs (CTP528) to calculate the modulation transfer function (MTF), and the HU
164
+ uniformity (CTP486) on the corresponding slice.
165
+
166
+ Features:
167
+
168
+ * **Automatic phantom registration** - Your phantom can be tilted, rotated, or translated--pylinac will register the phantom.
169
+ * **Automatic testing of 4 major modules** - Major modules are automatically registered and analyzed.
170
+ * **Any scan protocol** - Scan your CatPhan with any protocol; or even scan it in a regular CT scanner.
171
+ Any field size or field extent is allowed.
172
+
173
+ Example script::
174
+
175
+ from pylinac import CBCT
176
+
177
+ cbct = CBCT("my/cbct_image_folder")
178
+ cbct.analyze(hu_tolerance=40)
179
+ print(cbct.return_results())
180
+ cbct.plot_analyzed_image()
181
+
182
+ * `Log Analysis <http://pylinac.readthedocs.org/en/stable/log_analyzer.html>`_ -
183
+ The log analyzer module reads and parses Varian linear accelerator machine logs, both Dynalogs and Trajectory logs. The module also
184
+ calculates actual and expected fluences as well as performing gamma evaluations. Data is structured to be easily accessible and
185
+ easily plottable.
186
+
187
+ Unlike most other modules of pylinac, the log analyzer module has no end goal. Data is parsed from the logs, but what is done with that
188
+ info, and which info is analyzed is up to the user.
189
+
190
+ Features:
191
+
192
+ * **Analyze Dynalogs or Trajectory logs** - Either platform is supported. Tlog versions 2.1 and 3.0 supported.
193
+ * **Save Trajectory log data to CSV** - The Trajectory log binary data format does not allow for easy export of data. Pylinac lets you do
194
+ that so you can use Excel or other software that you use with Dynalogs.
195
+ * **Plot or analyze any axis** - Every data axis can be plotted: the actual, expected, and even the difference.
196
+ * **View actual or expected fluences & calculate gamma** - View fluences and gamma maps for any log.
197
+ * **Anonymization** - Anonymize your logs so you can share them with others.
198
+
199
+ Example script::
200
+
201
+ from pylinac import MachineLog
202
+
203
+ log = MachineLog("tlog.bin")
204
+ # after loading, explore any Axis of the Varian structure
205
+ log.axis_data.gantry.plot_actual() # plot the gantry position throughout treatment
206
+ log.fluence.gamma.calc_map(doseTA=1, distTA=1, threshold=10, resolution=0.1)
207
+ log.fluence.gamma.plot_map() # show the gamma map as a matplotlib figure
208
+
209
+ * `Picket Fence MLC Analysis <http://pylinac.readthedocs.org/en/stable/picketfence.html>`_ -
210
+ The picket fence module is meant for analyzing EPID images where a "picket fence" MLC pattern has been made.
211
+ Physicists regularly check MLC positioning through this test. This test can be done using film and one can
212
+ "eyeball" it, but this is the 21st century and we have numerous ways of quantifying such data. This module
213
+ attains to be one of them. It will load in an EPID dicom image and determine the MLC peaks, error of each MLC
214
+ pair to the picket, and give a few visual indicators for passing/warning/failing.
215
+
216
+ Features:
217
+
218
+ * **Analyze either HD or regular MLCs** - Just pass a flag and tell pylinac whether it's HD or not.
219
+ * **Easy-to-read pass/warn/fail overlay** - Analysis gives you easy-to-read tools for determining the status of an MLC pair.
220
+ * **Any Source-to-Image distance** - Whatever your clinic uses as the SID for picket fence, pylinac can account for it.
221
+ * **Account for panel translation** - Have an off-CAX setup? No problem. Translate your EPID and pylinac knows.
222
+ * **Account for panel sag** - If your EPID sags at certain angles, just tell pylinac and the results will be shifted.
223
+
224
+ Example script::
225
+
226
+ from pylinac import PicketFence
227
+
228
+ pf = PicketFence("mypf.dcm")
229
+ pf.analyze(tolerance=0.5, action_tolerance=0.25)
230
+ print(pf.return_results())
231
+ pf.plot_analyzed_image()
232
+
233
+ * `Flatness/Symmetry Analysis <http://pylinac.readthedocs.org/en/stable/flatsym.html>`_ -
234
+ Analysis of Flatness & Symmetry of film or EPID images. Multiple equation definitions, in/cross plane.
235
+
236
+ Documentation
237
+ -------------
238
+ To get started, install the package, run the demos, view the API docs, and learn the module design, visit the
239
+ `Full Documentation <http://pylinac.readthedocs.org/>`_ on Read The Docs.
240
+
241
+ Discussion
242
+ ----------
243
+ Have questions? Ask them here on the `pylinac forum <https://groups.google.com/forum/#!forum/pylinac>`_.
244
+
245
+ Contributing
246
+ ------------
247
+
248
+ Contributions to pylinac can be many. The most useful things a non-programmer can contribute are images to analyze and bug reports. If
249
+ you have VMAT images, starshot images, machine log files, CBCT DICOM files, or anything else you want analyzed, email or share them via Dropbox, Google Drive, etc: jkerns at gmail.com
250
+
251
+
252
+
@@ -0,0 +1,17 @@
1
+
2
+ __version__ = '1.5.0'
3
+ __version_info__ = (1, 5, 0)
4
+
5
+ import sys
6
+ if sys.version_info[0] < 3:
7
+ raise ValueError("Pylinac is only supported on Python 3.x. It seems you are using Python 2; please use a different interpreter.")
8
+
9
+ from pylinac.cbct import CBCT
10
+ from pylinac.flatsym import BeamImage
11
+ from pylinac.planar_imaging import LeedsTOR, PipsProQC3
12
+ from pylinac.log_analyzer import MachineLog, MachineLogs
13
+ from pylinac.picketfence import PicketFence
14
+ from pylinac.starshot import Starshot
15
+ from pylinac.vmat import VMAT
16
+ from pylinac.winston_lutz import WinstonLutz
17
+ from pylinac.core import decorators, geometry, image, io, mask, profile, roi, utilities