Skip to content

Commit

Permalink
v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkerns committed Feb 25, 2019
1 parent 963a333 commit 27f8177
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Version Release Checklist
- List changes in docs/source/changelog.rst
- If a new module:
- Add snippet to README.rst
- Build: run setup.py task..., `sdist` with option `bdist_wheel` to make a wheel
- Build: run setup.py task..., `bdist_wheel` to make a wheel
- Upload to PyPI: `twine upload dist/pylinac-...*` where ... is the version; e.g. `1.4.0`
to upload both the .zip and .whl files.
- Create conda distributions:
Expand Down
8 changes: 6 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
Changelog
=========

V 2.2.1
V 2.2.2
-------

Bug Fixes
^^^^^^^^^

* `#157 <https://github.com/jrkerns/pylinac/issues/157>`_ Dynalog MLC leaf error was calculated incorrectly. Expected positions were off by a row. Error results should be lower on average.
* `#160 <https://github.com/jrkerns/pylinac/issues/160>`_ Dynalog MLC leaf internal pair mapping (1-61 vs 1-120) was different than documentation. Fluence calculations should not change.
* `#162 <https://github.com/jrkerns/pylinac/issues/162>`_ The LeedsTOR `angle_offset` in the `.analyze()` method was not being followed by the high-contrast bubbles.
* `#144 <https://github.com/jrkerns/pylinac/issues/144>`_ The LeedsTOR angle determination is much more robust. Previously, only certain orientations of the phantom would correctly identify.


V 2.2.1
-------
Expand All @@ -18,7 +22,7 @@ Bug Fixes
^^^^^^^^^

* `#153 <https://github.com/jrkerns/pylinac/issues/153>`_ Log analyser PDF publishing fix.
* `#155 <https://github.com/jrkerns/pylinac/issues/155>`_ VMAT PDF report had tolerance listed incorrectly (absolute vs percentage) causing most tolerances to appear as zero.
* `#155 <https://github.com/jrkerns/pylinac/issues/155>`_ VMAT PDF report had tolerance listed incorrectly (absolute vs percentage) causing most tolerances to appear as zero due to rounding.

V 2.2.0
-------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# The short X.Y version.
version = '2.2'
# The full version, including alpha/beta/rc tags.
release = '2.2.1'
release = '2.2.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/planar_imaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ If you're having issues with the StandardImaging class, make sure you have corre
the manufacturer's instructions (also see :ref:`pipspro_image_acquisition`). One issue that may arise is incorrect
inversion. If the jaws are closed tightly around the phantom, the automatic inversion correction may falsely
invert the image, just as for the Leeds phantom. If you have an image that looks inverted or just plain weird, add ``invert=True``
to :meth:`~pylinac.planar_imaging.StandardImagingQC3.analyze`.
to :meth:`~pylinac.planar_imaging.StandardImagingQC3.analyze`. If this doesn't help, reshoot the phantom with the jaws open.


Las Vegas Phantom
Expand Down
4 changes: 2 additions & 2 deletions pylinac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import sys

__version__ = '2.2.1'
__version_info__ = (2, 2, 1)
__version__ = '2.2.2'
__version_info__ = (2, 2, 2)

# check python version
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
Expand Down
22 changes: 21 additions & 1 deletion pylinac/core/roi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Union, Tuple, Optional

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle as mpl_Circle

from skimage.measure._regionprops import _RegionProperties

Expand Down Expand Up @@ -57,6 +59,7 @@ def _get_shifted_center(angle: Union[float, int], dist_from_center: Union[float,
return Point(phantom_center.x + x_shift, phantom_center.y + y_shift)

@property
@lru_cache()
def pixel_value(self) -> np.ndarray:
"""The median pixel value of the ROI."""
masked_img = self.circle_mask()
Expand All @@ -68,7 +71,7 @@ def std(self) -> np.ndarray:
masked_img = self.circle_mask()
return np.nanstd(masked_img)

@lru_cache(maxsize=1)
@lru_cache()
def circle_mask(self) -> np.ndarray:
"""Return a mask of the image, only showing the circular ROI."""
# http://scikit-image.org/docs/dev/auto_examples/plot_camera_numpy.html
Expand All @@ -79,6 +82,23 @@ def circle_mask(self) -> np.ndarray:
masked_array[outer_disk_mask] = np.NaN
return masked_array

def plot2axes(self, axes=None, edgecolor: str='black', fill: bool=False):
"""Plot the Circle on the axes.
Parameters
----------
axes : matplotlib.axes.Axes
An MPL axes to plot to.
edgecolor : str
The color of the circle.
fill : bool
Whether to fill the circle with color or leave hollow.
"""
if axes is None:
fig, axes = plt.subplots()
axes.imshow(self._array)
axes.add_patch(mpl_Circle((self.center.x, self.center.y), edgecolor=edgecolor, radius=self.radius, fill=fill))


class LowContrastDiskROI(DiskROI):
"""A class for analyzing the low-contrast disks."""
Expand Down
1 change: 0 additions & 1 deletion pylinac/planar_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ def phantom_angle(self):
shift_percent = peak_idx / len(circle.values)
shift_radians = shift_percent * 2 * np.pi
shift_radians_corrected = 2*np.pi - shift_radians
print(f"angle: {shift_radians_corrected:.2f} radians; {np.rad2deg(shift_radians_corrected)} degrees")
return shift_radians_corrected

@property
Expand Down
6 changes: 4 additions & 2 deletions pylinac/starshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ def distance(p, lines):
"""Calculate the maximum distance to any line from the given point."""
return max(line.distance_to(Point(p[0], p[1])) for line in lines)

res = optimize.minimize(distance, sp.as_array(), args=(self.lines,), method='Nelder-Mead', options={'ftol': 0.001})
res = optimize.minimize(distance, sp.as_array(), args=(self.lines,), method='Nelder-Mead', options={'ftol': 0.0001})
# res = optimize.least_squares(distance, sp.as_array(), args=(self.lines,), ftol=0.001)

self.wobble.radius = res.fun
self.wobble.radius_mm = res.fun / self.image.dpmm
Expand Down Expand Up @@ -536,7 +537,7 @@ class StarProfile(CollapsedCircleProfile):
"""Class that holds and analyzes the circular profile which finds the radiation lines."""
def __init__(self, image, start_point, radius, min_peak_height, fwhm):
radius = self._convert_radius_perc2pix(image, start_point, radius)
super().__init__(center=start_point, radius=radius, image_array=image.array, width_ratio=0.1)
super().__init__(center=start_point, radius=radius, image_array=image.array, width_ratio=0.1, num_profiles=1)
self.get_peaks(min_peak_height, fwhm=fwhm)

@staticmethod
Expand Down Expand Up @@ -568,6 +569,7 @@ def get_peaks(self, min_peak_height, min_peak_distance=0.02, fwhm=True):
self.find_fwxm_peaks(x=80, threshold=min_peak_height, min_distance=min_peak_distance, interpolate=True)
else:
self.find_peaks(min_peak_height, min_peak_distance)
ttt = 1


def get_peak_height():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '2.2.1'
__version__ = '2.2.2'


setup(
Expand Down

0 comments on commit 27f8177

Please sign in to comment.