def test_load_from_file_object(self): path = osp.join(TEST_DIR, 'CBCT_4.zip') ref_cbct = CatPhan504.from_zip(path) with open(path, 'rb') as f: cbct = CatPhan504.from_zip(f) cbct.analyze() self.assertIsInstance(cbct, CatPhan504) self.assertEqual(cbct.origin_slice, ref_cbct.origin_slice)
def test_load_from_stream(self): path = osp.join(TEST_DIR, 'CBCT_4.zip') ref_cbct = CatPhan504.from_zip(path) with open(path, 'rb') as f: s = io.BytesIO(f.read()) cbct = CatPhan504.from_zip(s) cbct.analyze() self.assertIsInstance(cbct, CatPhan504) self.assertEqual(cbct.origin_slice, ref_cbct.origin_slice)
def run_catphan504(path): """Function to pass to the process pool executor to process cbct images.""" try: mypf = CatPhan504.from_zip(path) mypf.analyze() return 'Success' except (ValueError, FileNotFoundError, BadZipfile) as e: return 'Failure: {} @ {}'.format(e, path)
def OpenDirectory(self, textparam): directory = QFileDialog.getExistingDirectory( self, 'Select backup directory') win_directory = QtCore.QDir.toNativeSeparators(directory) d.pathDir = win_directory mycbct = CatPhan504(win_directory) mycbct.analyze() mycbct.plot_analyzed_subimage('linearity') mycbct.save_analyzed_subimage('linearity.png', subimage='linearity') mycbct.publish_pdf(d.pathDir + '\\result.pdf', metadata={ "name": textparam, "unit": "TrueBeam STX" })
def setUpClass(cls): cls.cbct = CatPhan504.from_demo_images() cls.cbct.analyze()
def setUp(self): self.cbct = CatPhan504.from_demo_images()
def setUpClass(cls): cls.cbct = CatPhan504.from_demo_images() cls.cbct.analyze()
def setUp(self): self.cbct = CatPhan504.from_demo_images()
def test_504(self): CatPhan504.run_demo()