Skip to content

Commit

Permalink
Merged in bugfix/RAM-2228_snc_mv_scaling (pull request #139)
Browse files Browse the repository at this point in the history
RAM-2228 fix ROI scaling for SNC MV (3.5.1)

Approved-by: Randy Taylor
  • Loading branch information
jrkerns committed Dec 29, 2022
2 parents b7c9e1f + 9804997 commit 641876e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.5.0
current_version = 3.5.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize =
{major}.{minor}.{patch}
Expand Down
5 changes: 5 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Changelog
=========

v 3.5.1
-------

* Fixed a bug with the SNC MV phantom analysis where the ROI scaling for the entire phantom was slightly over-sized.

v 3.5.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 = '3.5'
# The full version, including alpha/beta/rc tags.
release = '3.5.0'
release = '3.5.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 10 additions & 0 deletions pylinac/planar_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,16 @@ def _phantom_angle_calc(self) -> float:
"""
return 45

def _phantom_radius_calc(self) -> float:
"""The radius of the phantom in pixels; the value itself doesn't matter, it's just
used for relative distances to ROIs.
Returns
-------
radius : float
"""
return math.sqrt(self.phantom_ski_region.bbox_area) * 0.095


class SNCMV12510(SNCMV):
"""The older SNC MV QA phantom w/ model number 1251000"""
Expand Down
2 changes: 1 addition & 1 deletion pylinac/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.5.0"
__version__ = "3.5.1"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pylinac"
version = "3.5.0"
version = "3.5.1"
description = "A toolkit for performing TG-142 QA-related tasks on a linear accelerator"
authors = ["James Kerns <jkerns100@gmail.com>"]
license = "MIT"
Expand Down
41 changes: 21 additions & 20 deletions tests_basic/test_planar_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@

class GeneralTests(TestCase):
def test_from_file_object(self):
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds_ccw.dcm"])
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds", "Leeds_ccw.dcm"])
with open(path, "rb") as f:
phan = LeedsTOR(f)
phan.analyze()
self.assertIsInstance(phan, LeedsTOR)

def test_from_stream(self):
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds_ccw.dcm"])
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds", "Leeds_ccw.dcm"])
with open(path, "rb") as f:
s = io.BytesIO(f.read())
phan = LeedsTOR(s)
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_multiple_plots(self):
phan.save_analyzed_image() # no filename and no streams is an error

def test_passing_image_kwargs(self):
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds_ccw.dcm"])
path = get_file_from_cloud_test_repo([TEST_DIR, "Leeds", "Leeds_ccw.dcm"])

# do normal analysis
phan = LeedsTOR(path)
Expand Down Expand Up @@ -211,46 +211,45 @@ def test_results(self):
self.assertIsInstance(self.instance.results(), str)


class LeedsDemo(PlanarPhantomMixin, TestCase):
class LeedsMixin(PlanarPhantomMixin):
klass = LeedsTOR
dir_path = ['planar_imaging', 'Leeds']


class LeedsDemo(LeedsMixin, TestCase):
mtf_50 = 1.5

def test_demo(self):
LeedsTOR.run_demo() # shouldn't raise


class LeedsCCW(PlanarPhantomMixin, TestCase):
klass = LeedsTOR
class LeedsCCW(LeedsMixin, TestCase):
mtf_50 = 1.5
file_name = "Leeds_ccw.dcm"


class Leeds45Deg(PlanarPhantomMixin, TestCase):
klass = LeedsTOR
class Leeds45Deg(LeedsMixin, TestCase):
invert = True # inverted in v3.0 due to changed default inversion behavior
mtf_50 = 1.9
ssd = 1500
file_name = "Leeds-45deg.dcm"


class LeedsDirtyEdges(PlanarPhantomMixin, TestCase):
klass = LeedsTOR
class LeedsDirtyEdges(LeedsMixin, TestCase):
mtf_50 = 1.3
ssd = 1000
file_name = "Leeds-dirty-edges.dcm"


class LeedsBlue(PlanarPhantomMixin, TestCase):
class LeedsBlue(LeedsMixin, TestCase):
klass = LeedsTORBlue
dir_path = ["planar_imaging", "Leeds"]
mtf_50 = 1.5
ssd = 1450
file_name = "Leeds_Blue.dcm"


class LeedsBlueRotated(PlanarPhantomMixin, TestCase):
class LeedsBlueRotated(LeedsMixin, TestCase):
klass = LeedsTORBlue
dir_path = ["planar_imaging", "Leeds"]
mtf_50 = 1.5
ssd = 1450
file_name = "Leeds_Blue.dcm"
Expand All @@ -263,16 +262,14 @@ def preprocess(cls, instance):


@skip("Phantom appears distorted. MTF locations are different than other phantoms")
class LeedsClosedBlades(PlanarPhantomMixin, TestCase):
klass = LeedsTOR
class LeedsClosedBlades(LeedsMixin, TestCase):
mtf_50 = 1.3
ssd = 1500
file_name = "Leeds-closed-blades.dcm"


class LeedsACB1(PlanarPhantomMixin, TestCase):
klass = LeedsTOR
dir_path = ["planar_imaging", "ACB 1"]
class LeedsACB1(LeedsMixin, TestCase):
dir_path = ["planar_imaging", "Leeds", "ACB 1"]
file_path = "1.dcm"
mtf_50 = 1.4

Expand Down Expand Up @@ -377,17 +374,21 @@ def test_demo(self):
class SNCkVDemo(PlanarPhantomMixin, TestCase):
klass = SNCkV
mtf_50 = 1.76
median_contrast = 0.17
median_cnr = 69.4

def test_demo(self):
SNCkV.run_demo()


class SNCMVDemo(PlanarPhantomMixin, TestCase):
klass = SNCMV
median_cnr = 81
median_contrast = 0.21
mtf_50 = 0.43

def test_demo(self):
SNCkV.run_demo()
SNCMV.run_demo()


class SNCMV12510_6MV1(PlanarPhantomMixin, TestCase):
Expand Down

0 comments on commit 641876e

Please sign in to comment.