Exemple #1
0
class PFDemo(PFTestMixin, TestCase):
    """Tests specifically for the EPID demo image."""
    im_path = osp.join(osp.dirname(osp.dirname(__file__)), 'pylinac',
                       'demo_files', 'picket_fence', 'EPID-PF-LR.dcm')
    picket_orientation = 'Left-Right'
    max_error = 0.217
    abs_median_error = 0.06

    def test_demo(self):
        self.pf.run_demo()

    def test_demo_lower_tolerance(self):
        pf = PicketFence.from_demo_image()
        pf.analyze(0.15, action_tolerance=0.05)
        pf.plot_analyzed_image()
        self.assertAlmostEqual(pf.percent_passing, 94, delta=1)
Exemple #2
0
 def test_filter_on_load(self):
     PicketFence(osp.join(osp.dirname(osp.dirname(__file__)), 'pylinac', 'demo_files', 'picket_fence',
                 'EPID-PF-LR.dcm'), filter=3)
 def setUpClass(cls):
     path1 = osp.join(test_file_dir, 'combo-jaw.dcm')
     path2 = osp.join(test_file_dir, 'combo-mlc.dcm')
     cls.pf = PicketFence.from_multiple_images([path1, path2])
     cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)
from unittest import TestCase

from pylinac.picketfence import PicketFence, osp, np
from tests.utils import save_file

test_file_dir = osp.join(osp.dirname(__file__), 'test_files', 'Picket Fence')


class PFTestMixin:
    """Base Mixin for testing a picketfence image."""
    im_path = ''
    picket_orientation = 'Up-Down'
    hdmlc = False
    num_pickets = 10
    percent_passing = 100
    max_error = 0
    abs_median_error = 0
    sag_adjustment = 0
    passes = True

    @classmethod
    def setUpClass(cls):
        cls.pf = PicketFence(cls.im_path)
        cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)

    def test_passed(self):
        self.assertEqual(self.pf.passed, self.passes)

    def test_picket_orientation(self):
        self.assertEqual(self.pf.orientation, self.picket_orientation)
Exemple #5
0
 def setUpClass(cls):
     path1 = osp.join(test_file_dir, 'combo-jaw.dcm')
     path2 = osp.join(test_file_dir, 'combo-mlc.dcm')
     cls.pf = PicketFence.from_multiple_images([path1, path2])
     cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)
Exemple #6
0
 def test_filter_on_load(self):
     PicketFence(osp.join(osp.dirname(osp.dirname(__file__)), 'pylinac',
                          'demo_files', 'picket_fence', 'EPID-PF-LR.dcm'),
                 filter=3)
Exemple #7
0
from unittest import TestCase

import matplotlib.pyplot as plt

from pylinac.picketfence import PicketFence, osp, np
from tests.utils import save_file

test_file_dir = osp.join(osp.dirname(__file__), 'test_files', 'Picket Fence')


class PFTestMixin:
    """Base Mixin for testing a picketfence image."""
    im_path = ''
    picket_orientation = 'Up-Down'
    hdmlc = False
    num_pickets = 10
    percent_passing = 100
    max_error = 0
    abs_median_error = 0
    sag_adjustment = 0
    passes = True

    @classmethod
    def setUpClass(cls):
        cls.pf = PicketFence(cls.im_path)
        cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)

    @classmethod
    def tearDownClass(cls):
        plt.close('all')