class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dicomVisWidget = DicomVis() self.ui.verticalLayout.insertWidget(0, self.dicomVisWidget) studypath = "C:\\DICOM_resources\\BRAINIX\\T1-3D-FFE-C - 801" self.dicomVisWidget.load_study_from_path(studypath) @QtCore.pyqtSlot() def on_loadStudyBtn_clicked(self): dicompath = str(QtGui.QFileDialog.getExistingDirectory(None, "Open Directory", "/home", QtGui.QFileDialog.ShowDirsOnly)) try: self.dicomVisWidget.load_study_from_path(dicompath) except: infobox = QtGui.QMessageBox(QtGui.QMessageBox.Critical, "Error", "Ups! Something went wrong") infobox.exec_() @QtCore.pyqtSlot() def on_actionAbout_triggered(self): infobox = QtGui.QMessageBox(QtGui.QMessageBox.Information, "About", "by: MKozuch") infobox.exec_()
def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dicomVisWidget = DicomVis() self.opened_list = [] self.ui.verticalLayout.insertWidget(0, self.dicomVisWidget)
class MainWindow(QtWidgets.QMainWindow): def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dicomVisWidget = DicomVis() self.opened_list = [] self.ui.verticalLayout.insertWidget(0, self.dicomVisWidget) #studypath = '' #self.dicomVisWidget.load_study_from_path(studypath) def closeEvent(self, event): replay = QtWidgets.QMessageBox.question( self, 'Message', "Are you sure to quit?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) if replay == QtWidgets.QMessageBox.Yes: event.accept() else: event.ignore() def center(self): qr = self.frameGeometry() #得到主窗口大小 cp = QtWidgets.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) @QtCore.pyqtSlot() def on_loadStudyBtn_clicked(self): #dicompath = str(QtWidgets.QFileDialog.getExistingDirectory(None, "Open Directory", "/home", QtWidgets.QFileDialog.ShowDirsOnly)) self.dicomVisWidget.load_study_from_path('./17/17_clean2.nrrd') ''' except: infobox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "Error", "Something went wrong") infobox.exec_() ''' ''' self.opened_list.append(dicompath.split('/')[-1]) self.model = QtGui.QStandardItemModel() for file in self.opened_list: item = QtGui.QStandardItem(file) item.setCheckState(False) item.setCheckable(True) self.model.appendRow(item) self.dicomVisWidget.ui.opened_view.setModel(self.model) ''' @QtCore.pyqtSlot() def on_actionAbout_triggered(self): infobox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information, "About", "by:") infobox.exec_()
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dicomVisWidget = DicomVis() self.ui.verticalLayout.insertWidget(0, self.dicomVisWidget) studypath = "C:\\DICOM_resources\\BRAINIX\\T1-3D-FFE-C - 801" self.dicomVisWidget.load_study_from_path(studypath)