Exemplo n.º 1
0
    def slot1(self):
        file = open("file.txt", "w")
        directory = QFileDialog.getExistingDirectory(
            self, 'Select backup directory')
        win_directory = QtCore.QDir.toNativeSeparators(directory)
        wl = WinstonLutz(win_directory)
        d.getCountImages = len(wl.images)
        d.pathDir = win_directory
        wl.images[0].plot()
        self.ui.pushButton__ConeOpen.setEnabled(False)
        self.ui.pushButton__SummaryCone.setEnabled(False)
        self.ui.pushButton__ConeIzoSize.setEnabled(False)

        a = wl.results()
        file.write(str(a))
        file.close()
Exemplo n.º 2
0
 def setUpClass(cls):
     filename = cls.get_filename()
     if cls.zip:
         cls.wl = WinstonLutz.from_zip(filename)
     else:
         cls.wl = WinstonLutz(filename)
Exemplo n.º 3
0
 def test_invalid_dir(self):
     with self.assertRaises(ValueError):
         WinstonLutz(r'nonexistant/dir')
Exemplo n.º 4
0
 def test_loading_1_image_fails(self):
     with self.assertRaises(ValueError):
         WinstonLutz(osp.join(TEST_DIR, 'lutz', '1_image'))
Exemplo n.º 5
0
    def QA_Report(self):
        # app.config['MONGO_URI'] = "mongodb://localhost:27017/WinstonLutzTest"
        # mongo = PyMongo(app)

        client = MongoClient('localhost', 27017)
        db = client.QA
        fs = gridfs.GridFS(db)

        init_dir = os.getcwd()

        os.chdir(self.direct_name)
        fnames = glob.glob('*.dcm')

        position = [
            'Gantry270Couch0.dcm', 'Gantry0Couch0.dcm', 'Gantry90Couch0.dcm',
            'Gantry180Couch0.dcm', 'Gantry0Couch90.dcm', 'Gantry0Couch45.dcm',
            'Gantry0Couch315.dcm', 'Gantry0Couch270.dcm'
        ]

        for i, fname in enumerate(fnames):
            name = position[i]
            shutil.move(fname, name)

        wl = WinstonLutz(self.direct_name, use_filenames=True)
        # wl.plot_summary()
        wl.save_summary('summary.png')
        plt.close()

        r = wl.results()
        rr = r.split('\n')
        wltreportname = 'WLT' + datetime.now().strftime('%d%m%Y') + '.pdf'

        # c = canvas.Canvas('WLT'+ datetime.now().strftime('%d%m%Y') + '.pdf')
        c = canvas.Canvas(wltreportname)

        c.setLineWidth(0.3)
        c.drawImage(init_dir + "\\images\\qmh_logo.png", 50, 750, 90, 80)
        c.drawString(150, 780,
                     'Department of Clinical Oncology Medical Physics Unit')
        c.drawString(50, 700, 'Date: ' + datetime.now().strftime('%d-%m-%Y'))
        c.drawString(50, 685, 'LINAC: ' + self.LINAC)
        y = 670
        for line in rr:
            c.drawString(50, y, line)
            y -= 15
        c.drawImage('summary.png', 30, 20, 7 * inch, 5 * inch)
        c.save()

        fileID = fs.put(open(wltreportname, 'rb'))

        db.WLTest.insert_one({
            'LINAC':
            self.LINAC,
            'QA Date':
            datetime.now().strftime('%d-%m-%Y'),
            'Gantry Isocenter Size':
            str(('%.4f' % wl.gantry_iso_size)),
            'Couch Isocenter Size':
            str(('%.4f' % wl.couch_iso_size)),
            'PV Isocenter Size':
            str(('%.4f' % wl.collimator_iso_size)),
            'reportpdf':
            wltreportname
        })

        return wltreportname
Exemplo n.º 6
0
 def test_loading_1_image_fails(self):
     with self.assertRaises(ValueError):
         folder = get_folder_from_cloud_test_repo(['Winston-Lutz', 'lutz', '1_image'])
         WinstonLutz(folder)
Exemplo n.º 7
0
 def getEpidSag(self):
     wl = WinstonLutz(d.pathDir)
     wl.plot_epid_sag()
Exemplo n.º 8
0
 def GetConeIzoSize(self):
     wl = WinstonLutz(d.pathDir)
     self.ui.label_CouchZize.setText(
         str('{0:.2f}'.format(wl.couch_iso_size)))
     self.ui.label_GentryIZOSIZE.setText(
         str('{0:.2f}'.format(wl.gantry_iso_size)))
Exemplo n.º 9
0
 def summeryCone(self):
     wl = WinstonLutz(d.pathDir)
     wl.plot_coneSummery()
     wl.publishCone_pdf(d.pathDir + '//resultCone.pdf')
Exemplo n.º 10
0
 def sumary_Info(self):
     wl = WinstonLutz(d.pathDir)
     wl.plot_summary()
     wl.publish_pdf(d.pathDir + '//result.pdf')
Exemplo n.º 11
0
 def GentrySag(self):
     wl = WinstonLutz(d.pathDir)
     wl.plot_gantry_sag()
Exemplo n.º 12
0
 def setUpClass(cls):
     cls.wl = WinstonLutz(cls.image_dir)
Exemplo n.º 13
0
 def test_run_demo(self):
     WinstonLutz().run_demo()  # shouldn't raise