Esempio n. 1
0
 def test_load_trajectory_log_from_file_object(self):
     path = get_file_from_cloud_test_repo(
         ['mlc_logs', 'tlogs', 'dynamic_imrt.bin'])
     ref_log = TrajectoryLog(path)
     with open(path, 'rb') as f:
         t = TrajectoryLog(f)
     self.assertIsInstance(t, TrajectoryLog)
     self.assertEqual(t.num_beamholds, ref_log.num_beamholds)
Esempio n. 2
0
    def test_txt_file_also_loads_if_around(self):
        # has a .txt file
        log_with_txt = osp.join(
            TEST_DIR, 'mixed_types',
            "Anonymous_4DC Treatment_JST90_TX_20140712094246.bin")

        log = TrajectoryLog(log_with_txt)
        self.assertIsNotNone(log.txt)
        self.assertIsInstance(log.txt, dict)
        self.assertEqual(log.txt['Patient ID'], 'Anonymous')

        # DOESN'T have a txt file
        log_no_txt = osp.join(
            TEST_DIR, 'tlogs',
            "Anonymous_4DC Treatment_JS0_TX_20140712095629.bin")

        log = TrajectoryLog(log_no_txt)
        self.assertIsNone(log.txt)
Esempio n. 3
0
    def test_txt_file_also_loads_if_around(self):
        # has a .txt file
        _ = get_folder_from_cloud_test_repo(['mlc_logs', 'mixed_types'])
        log_with_txt = get_file_from_cloud_test_repo([
            'mlc_logs', 'mixed_types',
            "Anonymous_4DC Treatment_JST90_TX_20140712094246.bin"
        ])

        log = TrajectoryLog(log_with_txt)
        self.assertIsNotNone(log.txt)
        self.assertIsInstance(log.txt, dict)
        self.assertEqual(log.txt['Patient ID'], 'Anonymous')

        # DOESN'T have a txt file
        _ = get_folder_from_cloud_test_repo(['mlc_logs', 'tlogs'])
        log_no_txt = get_file_from_cloud_test_repo([
            'mlc_logs', 'tlogs',
            "Anonymous_4DC_Treatment_JS0_TX_20140712095629.bin"
        ])

        log = TrajectoryLog(log_no_txt)
        self.assertIsNone(log.txt)
Esempio n. 4
0
 def test_destination(self):
     tlog_file = osp.join(
         ANONYMOUS_DEST_FOLDER,
         'PatientID_4DC Treatment_JST90_TX_20140712094246.bin')
     tlog = TrajectoryLog(tlog_file)
     tlog.anonymize(destination=ANONYMOUS_DEST_FOLDER)  # shouldn't raise
Esempio n. 5
0
 def setUpClass(cls):
     cls.log = TrajectoryLog.from_demo()
     cls.log.fluence.gamma.calc_map()
Esempio n. 6
0
 def test_publish_pdf_w_imaging_log(self):
     imaging_tlog = TrajectoryLog(
         get_file_from_cloud_test_repo(['mlc_logs', 'tlogs',
                                        'imaging.bin']))
     with self.assertRaises(ValueError), tempfile.NamedTemporaryFile() as t:
         imaging_tlog.publish_pdf(t.name)
Esempio n. 7
0
 def setUpClass(cls):
     cls.tlog = TrajectoryLog.from_demo()
     cls.dlog = Dynalog.from_demo()
Esempio n. 8
0
 def test_calc_gamma_early_fails(self):
     log = TrajectoryLog.from_demo()
     with self.assertRaises(ValueError):
         log.fluence.gamma.plot_map()
Esempio n. 9
0
 def test_dynamic_imrt_log(self):
     tlog = TrajectoryLog(
         get_file_from_cloud_test_repo(
             ['mlc_logs', 'tlogs', 'dynamic_imrt.bin']))
     self.assertTrue(tlog.treatment_type, TreatmentType.DYNAMIC_IMRT.value)
Esempio n. 10
0
 def test_imaging_log(self):
     tlog = TrajectoryLog(
         get_file_from_cloud_test_repo(['mlc_logs', 'tlogs',
                                        'imaging.bin']))
     self.assertTrue(tlog.treatment_type, TreatmentType.IMAGING.value)
Esempio n. 11
0
 def test_vmat_log(self):
     tlog = TrajectoryLog(
         get_file_from_cloud_test_repo(['mlc_logs', 'tlogs', 'vmat.bin']))
     self.assertTrue(tlog.treatment_type, TreatmentType.VMAT.value)
Esempio n. 12
0
 def test_dynamic_imrt_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'dynamic_imrt.bin'))
     self.assertTrue(tlog.treatment_type, DYNAMIC_IMRT)
Esempio n. 13
0
 def test_static_imrt_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'static_imrt.bin'))
     self.assertTrue(tlog.treatment_type, STATIC_IMRT)
Esempio n. 14
0
 def test_vmat_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'vmat.bin'))
     self.assertTrue(tlog.treatment_type, VMAT)
Esempio n. 15
0
 def test_imaging_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'imaging.bin'))
     self.assertTrue(tlog.treatment_type, IMAGING)
Esempio n. 16
0
 def test_publish_pdf_w_imaging_log(self):
     imaging_tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs',
                                           'imaging.bin'))
     with self.assertRaises(ValueError), tempfile.TemporaryFile() as t:
         imaging_tlog.publish_pdf(t)