Exemple #1
0
 def test_load_from_file_object(self):
     pf_file = osp.join(TEST_DIR, 'PF.dcm')
     ref_pf = PicketFence(pf_file)
     ref_pf.analyze()
     with open(pf_file, 'rb') as f:
         pf = PicketFence(f)
         pf.analyze()
     self.assertIsInstance(pf, PicketFence)
     self.assertEqual(pf.percent_passing, ref_pf.percent_passing)
Exemple #2
0
 def test_load_from_stream(self):
     pf_file = osp.join(TEST_DIR, 'PF.dcm')
     ref_pf = PicketFence(pf_file)
     ref_pf.analyze()
     with open(pf_file, 'rb') as f:
         s = io.BytesIO(f.read())
         pf = PicketFence(s)
         pf.analyze()
     self.assertIsInstance(pf, PicketFence)
     self.assertEqual(pf.percent_passing, ref_pf.percent_passing)
Exemple #3
0
 def setUpClass(cls):
     cls.pf = PicketFence(cls.get_filename(), log=cls.get_logfile())
     if cls.pass_num_pickets:
         cls.pf.analyze(sag_adjustment=cls.sag_adjustment,
                        num_pickets=cls.num_pickets,
                        invert=cls.invert)
     else:
         cls.pf.analyze(sag_adjustment=cls.sag_adjustment,
                        invert=cls.invert)
Exemple #4
0
    def test_mlc_string(self):
        mlc_setup = 'Millennium'

        # pass it in to the mlc parameter
        path = osp.join(TEST_DIR, 'AS500_PF.dcm')
        pf = PicketFence(path, mlc=mlc_setup)

        # shouldn't raise
        pf.analyze()
        pf.results()
        pf.results_data()
Exemple #5
0
    def test_custom_MLC_arrangement(self):
        mlc_setup = MLCArrangement(leaf_arrangement=[(10, 10), (40, 5), (10,
                                                                         10)])

        # pass it in to the mlc parameter
        path = osp.join(TEST_DIR, 'AS500_PF.dcm')
        pf = PicketFence(path, mlc=mlc_setup)

        # shouldn't raise
        pf.analyze()
        pf.results()
        pf.results_data()
Exemple #6
0
 def setUpClass(cls):
     cls.pf = PicketFence(cls.get_filename(), log=cls.get_logfile())
     cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)
Exemple #7
0
 def test_load_with_log(self):
     log_file = osp.join(TEST_DIR, 'PF_log.bin')
     pf_file = osp.join(TEST_DIR, 'PF.dcm')
     pf = PicketFence(pf_file, log=log_file)
     pf.analyze(hdmlc=True)
Exemple #8
0
 def test_filter_on_load(self):
     PicketFence(self.constructor_input, filter=3)  # shouldn't raise
 def setUpClass(cls):
     cls.pf = PicketFence(cls.get_filename(), log=cls.get_logfile())
     if cls.pass_num_pickets:
         cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment, num_pickets=cls.num_pickets)
     else:
         cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)
Exemple #10
0
 def test_no_measurements_suggests_inversion(self):
     file_loc = osp.join(TEST_DIR, 'noisy-FFF-wide-gap-pf.dcm')
     pf = PicketFence(file_loc)
     with self.assertRaises(ValueError):
         pf.analyze(invert=False)
Exemple #11
0
 def setUpClass(cls):
     cls.pf = PicketFence(cls.get_filename(), log=cls.get_logfile())
     cls.pf.image.rot90()
     cls.pf.analyze(sag_adjustment=cls.sag_adjustment)
Exemple #12
0
 def setUpClass(cls):
     cls.pf = PicketFence(cls.im_path)
     cls.pf.analyze(hdmlc=cls.hdmlc, sag_adjustment=cls.sag_adjustment)
Exemple #13
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)