def initUI(self): cw = QWidget() self.setCentralWidget(cw) grid = QGridLayout() grid.setSpacing(15) # status bar self.statusBar().showMessage('Ready') font_label = QFont() font_label.setBold(True) ################ dicom reader rstart = 0 text_dcm = QLabel('DICOM reader') text_dcm.setFont(font_label) self.text_dcm_dir = QLabel('DICOM dir:') self.text_dcm_data = QLabel('DICOM data:') self.text_dcm_out = QLabel('output file:') grid.addWidget(text_dcm, rstart + 0, 1, 1, 4) grid.addWidget(self.text_dcm_dir, rstart + 1, 1, 1, 4) grid.addWidget(self.text_dcm_data, rstart + 2, 1, 1, 4) grid.addWidget(self.text_dcm_out, rstart + 3, 1, 1, 4) btn_dcmdir = QPushButton("Load DICOM", self) btn_dcmdir.clicked.connect(self.loadDcmDir) btn_dcmred = QPushButton("Organ Segmentation", self) btn_dcmred.clicked.connect(self.organSegmentation) btn_dcmcrop = QPushButton("Crop", self) btn_dcmcrop.clicked.connect(self.cropDcm) btn_dcmsave = QPushButton("Save DCM", self) btn_dcmsave.clicked.connect(self.saveDcm) grid.addWidget(btn_dcmdir, rstart + 4, 1) grid.addWidget(btn_dcmred, rstart + 4, 2) grid.addWidget(btn_dcmcrop, rstart + 4, 3) grid.addWidget(btn_dcmsave, rstart + 4, 4) hr = QFrame() hr.setFrameShape(QFrame.HLine) grid.addWidget(hr, rstart + 5, 0, 1, 6) # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) grid.addWidget(btn_quit, 24, 2, 1, 2) cw.setLayout(grid) self.setWindowTitle('liver-surgery') self.show()
class MainWindow(QMainWindow): def __init__(self, parent=None): QMainWindow.__init__(self, parent) self.setFixedSize(600, 180) self.l0 = QLabel(self) self.l0.setFixedWidth(300) self.l0.setFixedHeight(40) self.l0.setAlignment(Qt.AlignCenter) self.l0.setText("Breathing(bpm)") self.l0.move(0, 0) self.l1 = QLabel(self) self.l1.setFixedWidth(300) self.l1.setFixedHeight(40) self.l1.setAlignment(Qt.AlignCenter) self.l1.setText("Heart Rate(bpm)") self.l1.move(300, 0) pe = QPalette() pe.setColor(QPalette.WindowText, Qt.yellow) pe.setColor(QPalette.Background, Qt.gray) self.l0.setAutoFillBackground(True) self.l0.setPalette(pe) self.l1.setAutoFillBackground(True) self.l1.setPalette(pe) self.l0.setFont(QFont("Roman times", 20, QFont.Bold)) self.l1.setFont(QFont("Roman times", 20, QFont.Bold)) self.lbr = QLabel(self) self.lbr.setFixedWidth(300) self.lbr.setFixedHeight(60) self.lbr.setAlignment(Qt.AlignCenter) self.lbr.setFont(QFont("Roman times", 55, QFont.Bold)) self.lbr.setText("Breathing") self.lbr.move(0, 75) self.lhr = QLabel(self) self.lhr.setFixedWidth(300) self.lhr.setFixedHeight(60) self.lhr.setAlignment(Qt.AlignCenter) self.lhr.setFont(QFont("Roman times", 55, QFont.Bold)) self.lhr.setText("Heart Rate") self.lhr.move(300, 75)