def test_from_stream(self): path = osp.join(TEST_DIR, 'Leeds_ccw.dcm') with open(path, 'rb') as f: s = io.BytesIO(f.read()) phan = LeedsTOR(s) phan.analyze() self.assertIsInstance(phan, LeedsTOR)
def test_results_data(self): phan = LeedsTOR.from_demo_image() phan.analyze() data = phan.results_data() self.assertIsInstance(data, PlanarResult) self.assertEqual( data.median_contrast, np.median([roi.contrast for roi in phan.low_contrast_rois])) data_dict = phan.results_data(as_dict=True) self.assertIsInstance(data_dict, dict) self.assertEqual(len(data_dict), 8) self.assertIn('pylinac_version', data_dict)
def OpenDialog(self, textparam): options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog fileName, _ = QFileDialog.getOpenFileName( self, "QFileDialog.getOpenFileName()", "", "All Files (*);;DICOM Files (*.dcm)", options=options) if fileName: leeds = LeedsTOR(fileName) leeds.analyze(low_contrast_threshold=0.01, hi_contrast_threshold=0.5) leeds.plot_analyzed_image(low_contrast=True) leeds.publish_pdf(fileName.title() + '.pdf', metadata={ "name": textparam, "unit": "TrueBeam STX" })
def run_leeds(path): """Function to pass to the process pool executor to process Leeds phantom images.""" leeds = LeedsTOR(path) return process_phantom(leeds, path)
def test_demo(self): LeedsTOR.run_demo() # shouldn't raise
def test_from_file_object(self): path = osp.join(TEST_DIR, 'Leeds_ccw.dcm') with open(path, 'rb') as f: phan = LeedsTOR(f) phan.analyze() self.assertIsInstance(phan, LeedsTOR)
def HightContrast(self): leeds = LeedsTOR(d.pathDir) leeds.plot_analyzed_image(low_contrast=False) leeds.publish_pdf(d.pathDir + '\\resultHightContrast.pdf')