Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 5
0
 def test_demo(self):
     LeedsTOR.run_demo()  # shouldn't raise
Ejemplo n.º 6
0
 def test_demo(self):
     LeedsTOR.run_demo()  # shouldn't raise
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 def HightContrast(self):
     leeds = LeedsTOR(d.pathDir)
     leeds.plot_analyzed_image(low_contrast=False)
     leeds.publish_pdf(d.pathDir + '\\resultHightContrast.pdf')