Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setWindowTitle("Dosia")
        self.resize(800, 800)
        self.move(300, 300)
        self.setWindowIcon(QIcon('gui/icon.svg'))
        self.guisettings = QSettings("BrentH", "Dosia")

        # Must load a valid dosia.ini dir
        if self.guisettings.value("dosiainidir") == None:
            self.setdosiainidir()
        elif path.isdir(self.guisettings.value("dosiainidir")):
            self.sett = gpumcd.Settings(self.guisettings.value("dosiainidir"))
        else:
            self.setdosiainidir()

        # Menu bar
        self.menu_load_file = QAction('&File(s) (RTPlan, Dose, CT)', self)
        self.menu_load_file.triggered.connect(self.loadfiles)
        self.menu_load_dir = QAction('&Directory (CT)', self)
        self.menu_load_dir.triggered.connect(self.loaddir)
        # self.menu_open_linaclog = QAction('&Linac Log', self)
        # self.menu_open_linaclog.triggered.connect(self.loadlinaclog)
        # self.menu_open_linaclog.setDisabled(True) #TODO: enable if rtplan loaded

        self.menu_gpumcd_calculate = QAction('&Calculate Dose with GPUMCD',
                                             self)
        self.menu_gpumcd_calculate.triggered.connect(self.calcgpumcd)
        self.menu_gpumcd_calculate.setDisabled(True)

        self.menu_setdosiainidir = QAction('&Set Dosia.ini directory', self)
        self.menu_setdosiainidir.triggered.connect(self.setdosiainidir)

        self.menu_bar = self.menuBar()
        self.menu_open = self.menu_bar.addMenu('&Load')
        self.menu_open.addAction(self.menu_load_file)
        self.menu_open.addAction(self.menu_load_dir)

        self.menu_gpumcd = self.menu_bar.addMenu('&Calculate')
        self.menu_gpumcd.addAction(self.menu_gpumcd_calculate)

        self.menu_dosia = self.menu_bar.addMenu('&Dosia')
        self.menu_dosia.addAction(self.menu_setdosiainidir)

        # Quadrants
        self.planpane = QWidget()
        self.plandosepane = QWidget()
        self.ctpane = QWidget()
        self.gpumcdpane = QWidget()
        self.resetpanes()

        # statusbar
        self.statusBar().showMessage(
            f'dosia.ini in {self.guisettings.value("dosiainidir")} loaded.')

        # done!
        self.show()
Esempio n. 2
0
import ctypes,numpy as np,os,math,time
from os import path
import gpumcd
import medimage as image

print('Start of program.')

sett = gpumcd.Settings("d:\\postdoc\\gpumcd_data")
print(sett.planSettings.goalSfom)

casedir = "d:\\postdoc\\analyses\\gpumcd_python"

ct_image=image.image(path.join(casedir,'ct.xdr'))
ct_image.ct_to_hu(1000,1)
ct_image.resample([3,3,3])

ct = gpumcd.CT(sett,ct_image) #for dicoms, dont set intercept,slope.

machfile = "d:/postdoc/gpumcd_data/machines/machine_van_sami/brentAgility.beamlets.gpumdt"

engine = gpumcd.Engine(sett,ct,machfile)

print('gpumcd init done.')

print (engine.lasterror())

start_time = time.time()



frame1size = 5
Esempio n. 3
0
import medimage as image, numpy as np, dicom, glob, os, collections
import gpumcd
from collections import Counter

sett = gpumcd.Settings()
loadimages = False
verbose = False

dumpdir = r"Z:\brent\dicom_incoming\20190412_w19_1149\DICOM"

# dumpdir = Path(r"D:\tmp\test")
# [print(a) for a in dumpdir.rglob('*') if a.is_file()]

# dcms = [dicom.pydicom_object(a) for a in dumpdir.rglob('*') if a.is_file()]
dcms = []
notdcms = []
problem = []
problemtypes = Counter()

studies = collections.defaultdict(dict)

for dirpath, dirnames, filenames in os.walk(dumpdir):
    if len(filenames) > 0:
        firstfname = os.path.join(dirpath, filenames[0])
        try:  #catch any problematic dcm
            # test if in CT dir
            dicomobj = dicom.pydicom_object(firstfname)
            if dicomobj.valid and dicomobj.sopid is None:
                #we've got a CT on our hands boys, yeehaw
                dcms.append(firstfname)
                studies[dicomobj.studyid]['ct'] = dirpath