Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New upstream updates #1

Merged
merged 34 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7b92666
fix watcher.py
alanphys Aug 31, 2018
0a0860c
Merge pull request #136 from alanphys/master
jrkerns Sep 5, 2018
610da56
Test mock import for RTD issue
jrkerns Oct 11, 2018
f97d817
Try new mock technique
jrkerns Oct 12, 2018
8e58e0b
Update issue templates
jrkerns Oct 13, 2018
eaca1c4
Test commit
jrkerns Oct 20, 2018
063445e
Update license year
jrkerns Oct 20, 2018
1e95c30
Closes #127
jrkerns Oct 22, 2018
78b4dbf
Closes #132
jrkerns Oct 22, 2018
24df268
Added Typing for most modules and PDF refactor effects. Closes #139 #139
jrkerns Oct 22, 2018
1cd7614
Default colormap for arrays is Viridis
jrkerns Oct 22, 2018
62511cb
Closes #133
jrkerns Oct 22, 2018
01ed71d
Add references in own dir
jrkerns Oct 22, 2018
c8d6fa6
added some typing and doc updates
jrkerns Oct 22, 2018
78e9c94
Updated GUI to new VMAT API
jrkerns Oct 22, 2018
6dc3e48
Update issue templates
jrkerns Oct 22, 2018
5f10712
snippet updates for newest version.
jrkerns Oct 24, 2018
6b9bb42
Updated calibration docs
jrkerns Oct 24, 2018
33ab9ec
updated all docs for v2.2
jrkerns Oct 24, 2018
0b53879
small adjusted refactor
jrkerns Oct 24, 2018
53316a5
Closes #141
jrkerns Oct 24, 2018
9fdf2ad
also part of #141
jrkerns Oct 24, 2018
7930779
small refactors and tweaks
jrkerns Oct 24, 2018
56e92ea
Merge remote-tracking branch 'github/master'
jrkerns Oct 24, 2018
22b25f1
Doc update for 2.2
jrkerns Oct 24, 2018
3971680
version bump
jrkerns Oct 24, 2018
eedf25a
Testing fixes
jrkerns Oct 24, 2018
b14a5c3
testing reframing
jrkerns Oct 24, 2018
8cc975e
small tweaks
jrkerns Oct 24, 2018
48fc49b
testing changes
jrkerns Oct 24, 2018
a7d7a5d
files change to be more descriptive and include w/ repo
jrkerns Oct 24, 2018
07c7656
further testing tweaks
jrkerns Oct 24, 2018
01cb8cf
test fix for flatsym to run in TravisCI
jrkerns Oct 24, 2018
6d7c7b3
Ready for v2.2 release
jrkerns Oct 25, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test:
# install your own package into the environment
- python setup.py install
# attempt to fix DISPLAY variable errors of matplotlib's. See: https://github.com/mwaskom/seaborn/pull/97
- cp tests/matplotlibrc .
- cp tests_basic/matplotlibrc .
script:
- python setup.py test
# - coverage run --source=pylinac setup.py test
Expand All @@ -23,7 +23,7 @@ coverage:
# install your own package into the environment
- python setup.py install
# attempt to fix DISPLAY variable errors of matplotlib's. See: https://github.com/mwaskom/seaborn/pull/97
- cp tests/matplotlibrc .
- cp tests_basic/matplotlibrc .
script:
# - python setup.py test
- coverage run --source=pylinac setup.py test
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"

env:
- NUMPY=1.12
- NUMPY=1.13
Expand Down Expand Up @@ -42,7 +41,7 @@ install:
# install your own package into the environment
- python setup.py install
# attempt to fix DISPLAY variable errors of matplotlib's. See: https://github.com/mwaskom/seaborn/pull/97
- cp tests/matplotlibrc .
- cp tests_basic/matplotlibrc .

# test script
script:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2016 James Kerns
Copyright (c) 2014-2018 James Kerns

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
Expand Down
106 changes: 57 additions & 49 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The web app is a proof-of-concept taking pylinac into the web!
Pylinac contains high-level modules for automatically analyzing images and data generated by linear accelerators.
Most scripts can be utilized with <10 lines of code. The built in GUI is also straight-forward although programming experience may help identify errors.

The library also contains lower-level `hackable modules & tools <http://pylinac.readthedocs.org/en/latest/pylinac_core_hacking.html>`_
The library also contains lower-level `hackable modules & tools <http://pylinac.readthedocs.org/en/stable/pylinac_core_hacking.html>`_
for creating your own radiation therapy algorithms.

The major features of the entire package include:
Expand All @@ -54,21 +54,13 @@ To get started, install the package, run the demos, view the API docs, and learn
Installation
------------

Pylinac should be installed via ``conda`` if available. First, add the proper channel, then install the package:

.. code-block:: bash

$ conda config --add channels jrkerns
$ conda install pylinac

You may also install via ``pip``, although you must have C compilers to build the
`dependencies <http://pylinac.readthedocs.io/en/latest/installation.html#dependencies>`_ :
Iinstall via ``pip``, just check the `dependencies <http://pylinac.readthedocs.io/en/stable/installation.html#dependencies>`_ first:

.. code-block:: bash

$ pip install pylinac

See the `Installation page <http://pylinac.readthedocs.io/en/latest/installation.html>`_ for further details.
See the `Installation page <http://pylinac.readthedocs.io/en/stable/installation.html>`_ for further details.

Tools/Quick Start Guide
-----------------------
Expand All @@ -83,7 +75,7 @@ Below are the high-level tools currently available:
import pylinac
pylinac.gui() # that simple

* `Continuous & One-Time Directory Analysis <http://pylinac.readthedocs.org/en/latest/watcher.html>`_ -
* `Continuous & One-Time Directory Analysis <http://pylinac.readthedocs.org/en/stable/watcher.html>`_ -
True, one-time "set it and forget it" service that analyzes any file that enters the folder. Files with
keywords and certain file types are analyzed automatically. You can also specify "source" folders to pull new files from (e.g.
a Varian shared drive holding Trajectory logs or QA images).
Expand All @@ -104,43 +96,61 @@ Below are the high-level tools currently available:
process("dir/to/watch") # will run once and then return

And that's it! No code to write; no fuss, no muss.
Analysis settings are `customizable <http://pylinac.readthedocs.org/en/latest/watcher.html#configuration>`_
Analysis settings are `customizable <http://pylinac.readthedocs.org/en/stable/watcher.html#configuration>`_
and includes optional email service upon analysis.

* `TG-51 Absolute Dose Calibration <http://pylinac.readthedocs.org/en/latest/tg51_docs.html>`_ -
* `TG-51 & TRS-398 Absolute Dose Calibration <http://pylinac.readthedocs.org/en/stable/calibration_docs.html>`_ -
Input the raw data and pylinac can calculate either individual values (kQ, PDDx, Pion, etc) or use the
provided classes to input all measurement data and have it calculate all factors and dose values automatically.

Example script:

.. code-block:: python

from pylinac import tg51

tg51_6x = tg51.TG51Photon(temp=TEMP, press=PRESS, model=CHAMBER,
n_dw=ND_w, p_elec=P_ELEC,
measured_pdd=66.4, lead_foil=None,
clinical_pdd=66.5, energy=ENERGY,
volt_high=-300, volt_low=-150,
m_raw=(25.65, 25.66, 25.65),
m_opp=(25.64, 25.65, 25.65),
m_low=(25.64, 25.63, 25.63),
mu=MU, tissue_correction=1.0)
from pylinac import tg51, trs398

ENERGY = 6
TEMP = 22.1
PRESS = tg51.mmHg2kPa(755.0)
CHAMBER = '30013' # PTW
P_ELEC = 1.000
ND_w = 5.443 # Gy/nC
MU = 200
CLINICAL_PDD = 66.5

tg51_6x = tg51.TG51Photon(
unit='TrueBeam1',
chamber=CHAMBER,
temp=TEMP, press=PRESS,
n_dw=ND_w, p_elec=P_ELEC,
measured_pdd10=66.4, lead_foil=None,
clinical_pdd10=66.5, energy=ENERGY,
voltage_reference=-300, voltage_reduced=-150,
m_reference=(25.65, 25.66, 25.65),
m_opposite=(25.64, 25.65, 25.65),
m_reduced=(25.64, 25.63, 25.63),
mu=MU, tissue_correction=1.0
)

# Done!
print(tg51_6x.dose_mu_dmax)

# examine other parameters
tg51_6x.pddx
tg51_6x.kq
tg51_6x.p_ion
print(tg51_6x.pddx)
print(tg51_6x.kq)
print(tg51_6x.p_ion)

# change readings if you adjust output
tg51_6x.m_raw = (25.44, 25.44, 25.43)
tg51_6x.m_reference_adjusted = (25.44, 25.44, 25.43)
# print new dose value
print(tg51_6x.dose_mu_dmax)
print(tg51_6x.dose_mu_dmax_adjusted)

# generate a PDF for record-keeping
tg51_6x.publish_pdf('TB1 6MV TG-51.pdf', notes=['My notes', 'I used Pylinac to do this; so easy!'], open_file=False)

# TRS-398 is very similar and just as easy!

* `Planar Phantom Analysis (Leeds TOR, StandardImaging QC-3, Las Vegas) <http://pylinac.readthedocs.org/en/latest/planar_imaging.html>`_ -
* `Planar Phantom Analysis (Leeds TOR, StandardImaging QC-3, Las Vegas) <http://pylinac.readthedocs.org/en/stable/planar_imaging.html>`_ -
The planar imaging module analyzes 2D phantoms. Currently the LeedsTOR kV phantom, Standard Imaging QC-3 MV phantom, and Las Vegas phantom are supported,
and more phantoms are in the works!

Expand Down Expand Up @@ -172,7 +182,7 @@ Below are the high-level tools currently available:
lv.plot_analyzed_image()
lv.publish_pdf('lv.pdf', open_file=True) # open the PDF after publishing

* `Winston-Lutz Analysis <http://pylinac.readthedocs.org/en/latest/winston_lutz.html>`_ -
* `Winston-Lutz Analysis <http://pylinac.readthedocs.org/en/stable/winston_lutz.html>`_ -
The Winston-Lutz module analyzes EPID images taken of a small radiation field and BB to determine the 2D
distance from BB to field CAX. Additionally, the isocenter size of the gantry, collimator, and couch can
all be determined *without the BB being at isocenter*. Analysis is based on
Expand Down Expand Up @@ -204,7 +214,7 @@ Below are the high-level tools currently available:
print(wl.results())
wl.publish_pdf('my_wl.pdf')

* `Starshot Analysis <http://pylinac.readthedocs.org/en/latest/starshot_docs.html>`_ -
* `Starshot Analysis <http://pylinac.readthedocs.org/en/stable/starshot_docs.html>`_ -
The Starshot module analyses a starshot image made of radiation spokes, whether gantry, collimator, MLC or couch.
It is based on ideas from `Depuydt et al <http://iopscience.iop.org/0031-9155/57/10/2997>`_
and `Gonzalez et al <http://dx.doi.org/10.1118/1.1755491>`_.
Expand Down Expand Up @@ -236,30 +246,28 @@ Below are the high-level tools currently available:
star.plot_analyzed_image() # shows a matplotlib figure
star.publish_pdf() # publish a PDF report

* `VMAT QA <http://pylinac.readthedocs.org/en/latest/vmat_docs.html>`_ -
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
* `VMAT QA <http://pylinac.readthedocs.org/en/stable/vmat_docs.html>`_ -
The VMAT module consists of two classes: ``DRGS`` and ``DRMLC``, which are capable of loading an EPID DICOM Open field image and MLC field image and analyzing the
images according to the Varian RapidArc QA tests and procedures, specifically the Dose-Rate & Gantry-Speed (DRGS) and MLC speed (MLCS) tests.

Features:

* **Do both tests** - Pylinac can handle either DRGS or DRMLC tests.
* **Adjust for offsets** - Older VMAT patterns were off-center. Easily account for the offset by passing it in.
* **Automatic identification using file names** - If your file names are clear, the image type and test type don't even
have to be specified; just load and analyze.
* **Adjust for offsets** - Older VMAT patterns were off-center. Pylinac will find the field regardless.

Example script:

.. code-block:: python

from pylinac import VMAT
from pylinac import DRGS, DRMLC

vmat = VMAT(images=["DRGSopen.dcm", "DRGSdmlc.dcm"], delivery_types=["open", "dmlc"])
vmat.analyze(test='drgs', tolerance=1.5)
print(vmat.return_results()) # prints out ROI information
vmat.plot_analyzed_image() # shows a matplotlib figure
vmat.publish_pdf('myvmat.pdf') # generate a PDF report
drgs = DRGS(image_paths=["path/to/DRGSopen.dcm", "path/to/DRGSdmlc.dcm"])
drgs.analyze(tolerance=1.5)
print(drgs.return_results()) # prints out ROI information
drgs.plot_analyzed_image() # shows a matplotlib figure
drgs.publish_pdf('mydrgs.pdf') # generate a PDF report

* `CT & CBCT QA <http://pylinac.readthedocs.org/en/latest/cbct_docs.html>`_ -
* `CT & CBCT QA <http://pylinac.readthedocs.org/en/stable/cbct_docs.html>`_ -
The CBCT module automatically analyzes DICOM images of a CatPhan 504, 503, or 600 acquired when doing CT or CBCT quality assurance. It can load a folder or zip file that
the images are in and automatically correct for phantom setup in 6 axes.
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
Expand All @@ -276,7 +284,7 @@ Below are the high-level tools currently available:

.. code-block:: python

from pylinac import CatPhan504, CatPhan503, CatPhan600
from pylinac import CatPhan504, CatPhan503, CatPhan600, CatPhan604

# for this example, we'll use the CatPhan504
cbct = CatPhan504("my/cbct_image_folder")
Expand All @@ -285,7 +293,7 @@ Below are the high-level tools currently available:
cbct.plot_analyzed_image()
cbct.publish_pdf('mycbct.pdf')

* `Log Analysis <http://pylinac.readthedocs.org/en/latest/log_analyzer.html>`_ -
* `Log Analysis <http://pylinac.readthedocs.org/en/stable/log_analyzer.html>`_ -
The log analyzer module reads and parses Varian linear accelerator machine logs, both Dynalogs and Trajectory logs. The module also
calculates actual and expected fluences as well as performing gamma evaluations. Data is structured to be easily accessible and
easily plottable.
Expand Down Expand Up @@ -318,7 +326,7 @@ Below are the high-level tools currently available:
dlog = load_log("dynalog.dlg")
...

* `Picket Fence MLC Analysis <http://pylinac.readthedocs.org/en/latest/picketfence.html>`_ -
* `Picket Fence MLC Analysis <http://pylinac.readthedocs.org/en/stable/picketfence.html>`_ -
The picket fence module is meant for analyzing EPID images where a "picket fence" MLC pattern has been made.
Physicists regularly check MLC positioning through this test. This test can be done using film and one can
"eyeball" it, but this is the 21st century and we have numerous ways of quantifying such data. This module
Expand All @@ -345,7 +353,7 @@ Below are the high-level tools currently available:
pf.plot_analyzed_image()
pf.publish_pdf()

* `Flatness/Symmetry Analysis <http://pylinac.readthedocs.org/en/latest/flatsym.html>`_ -
* `Flatness/Symmetry Analysis <http://pylinac.readthedocs.org/en/stable/flatsym.html>`_ -
Analysis of Flatness & Symmetry of film or EPID images. Multiple equation definitions, in/cross plane.

Discussion
Expand Down
Binary file added References/CTP604+Manual+9-15.pdf
Binary file not shown.
Binary file added References/Catphan+500+600+Manual+.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added References/Followill, PDD to TPR equation.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added References/Ling, Commissioning of RapidArc.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added References/TG-142 Linac QA.pdf
Binary file not shown.
Binary file added References/TG-51 Addendum (new kqs).pdf
Binary file not shown.
Binary file added References/TG-51 Linac Calibration.pdf
Binary file not shown.
Binary file added References/TOR 18FG user manual.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions checklist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version Release Checklist

- Run tests: tests/_test_all.py
- See if anything needs amending in the GUI or in the watcher since those are hard to test.
- Increment version number in:
- setup.py,
- pylinac/__init__.py
Expand Down
Loading