def getstring(text): if sys.version_info.major == 2: textout = QString.fromUtf8(text) elif sys.version_info.major == 3: textout = str(text) return textout
def _initUI(self): window = QtGui.QWidget() self.window = window self.setCentralWidget(window) self.resize(800, 600) self.setWindowTitle('LISA') self.statusBar().showMessage('Ready') self.mainLayout = QHBoxLayout(window) window.setLayout(self.mainLayout) self.ui_widgets = {} self.ui_buttons = {} #### MENU #### self.initUIMenu() line = QFrame() line.setFrameShape(QFrame.VLine) self.mainLayout.addWidget(line) ##### BODY ##### bodyLayout = QVBoxLayout() self.bodyLayout = bodyLayout self.mainLayout.addLayout(bodyLayout) #--- title --- self.infoBody = QtGui.QWidget() infoBodyLayout = QVBoxLayout() bodyLayout.addWidget(self.infoBody) self.infoBody.setLayout(infoBodyLayout) self.ui_widgets["Main"] = self.infoBody font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(12) lisa_title = QLabel('Liver Surgery Analyser') info = QLabel('Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('M. Jiřík, V. Lukeš - 2013') + '\n\nVersion: ' + self.oseg.version ) info.setFont(font_info) lisa_title.setFont(font_label) infoBodyLayout.addWidget(lisa_title) infoBodyLayout.addWidget(info) #--- segmentation option --- self.segBody = segmentationQt.SegmentationWidget(oseg=self.oseg) # self.segBody.oseg = self.oseg bodyLayout.addWidget(self.segBody) self.ui_widgets["Segmentation"] = self.segBody # self.segBody.lblSegData.setText(self.text_seg_data) self.segBody.btnVirtualResectionPV.clicked.connect(self.btnVirtualResectionPV) self.segBody.btnVirtualResectionPlanar.clicked.connect(self.btnVirtualResectionPlanar) self.segBody.btnVirtualResectionPV_testing.clicked.connect(self.btnVirtualResectionPV_new) ### self.segBody.btnSegManual.clicked.connect(self.btnManualSeg) self.segBody.btnSegSemiAuto.clicked.connect(self.btnSemiautoSeg) self.segBody.btnSegMask.clicked.connect(self.maskRegion) self.segBody.btnSegPV.clicked.connect(self.btnPortalVeinSegmentation) self.segBody.btnSegHV.clicked.connect(self.btnHepaticVeinsSegmentation) #--- edit slab --- self.slabBody = dictEditQt.DictEdit(dictionary=self.oseg) bodyLayout.addWidget(self.slabBody) self.ui_widgets["EditSlab"] = self.slabBody self.slabBody.btnSaveSlab.clicked.connect(self.segBody.reinitLabels) # -- load widget import io3d.datareaderqt self.read_widget = io3d.datareaderqt.DataReaderWidget( before_function=self._before_read_callback, after_function=self._after_read_callback ) self.read_widget.cache = self.oseg.cache bodyLayout.addWidget(self.read_widget) self.ui_widgets["Load"] = self.read_widget #--- file info (footer) --- bodyLayout.addStretch() self.oseg.gui_update = self.gui_update ##### OTHERS ##### self.mainLayout.addStretch() self.btnSave.setDisabled(True) self.btnSegmentation.setDisabled(True) self.btnCompare.setDisabled(True) self.changeWidget('Main') self.show()
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) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) ############# lisa_title = QLabel('Organ Segmentation with Random Walker') info = QLabel('Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('M. Jirik, V. Lukes, T. Ryba - 2013') ) info.setFont(font_info) lisa_title.setFont(font_label) lisa_logo = QLabel() logopath = os.path.join(path_to_script, 'kky_small.png') logo = QPixmap(logopath) lisa_logo.setPixmap(logo) grid.addWidget(lisa_title, 0, 1) grid.addWidget(info, 1, 1) grid.addWidget(lisa_logo, 0, 2, 2, 1) grid.setColumnMinimumWidth(1, logo.width()) ### dicom reader rstart = 2 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_dcm = QLabel('DICOM reader') text_dcm.setFont(font_label) btn_dcmdir = QPushButton("Load DICOM", self) btn_dcmdir.clicked.connect(self.loadDcmDir) btn_dcmcrop = QPushButton("Crop", self) btn_dcmcrop.clicked.connect(self.cropDcm) self.text_dcm_dir = QLabel('DICOM dir:') self.text_dcm_data = QLabel('DICOM data:') grid.addWidget(hr, rstart + 0, 0, 1, 4) grid.addWidget(text_dcm, rstart + 1, 1, 1, 2) grid.addWidget(btn_dcmdir, rstart + 2, 1) grid.addWidget(btn_dcmcrop, rstart + 2, 2) grid.addWidget(self.text_dcm_dir, rstart + 5, 1, 1, 2) grid.addWidget(self.text_dcm_data, rstart + 6, 1, 1, 2) rstart += 8 # ################ segmentation hr = QFrame() hr.setFrameShape(QFrame.HLine) text_seg = QLabel('Segmentation') text_seg.setFont(font_label) btn_segauto = QPushButton("Automatic seg.", self) btn_segauto.clicked.connect(self.autoSeg) btn_segman = QPushButton("Manual seg.", self) btn_segman.clicked.connect(self.manualSeg) self.text_seg_data = QLabel('segmented data:') grid.addWidget(hr, rstart + 0, 0, 1, 4) grid.addWidget(text_seg, rstart + 1, 1) grid.addWidget(btn_segauto, rstart + 2, 1) grid.addWidget(btn_segman, rstart + 2, 2) grid.addWidget(self.text_seg_data, rstart + 3, 1, 1, 2) rstart += 4 # ################ save/view btn_segsave = QPushButton("Save", self) btn_segsave.clicked.connect(self.saveOut) btn_segsavedcm = QPushButton("Save Dicom", self) btn_segsavedcm.clicked.connect(self.saveOutDcm) btn_segview = QPushButton("View3D", self) if viewer3D_available: btn_segview.clicked.connect(self.view3D) else: btn_segview.setEnabled(False) grid.addWidget(btn_segsave, rstart + 0, 1) grid.addWidget(btn_segview, rstart + 0, 2) grid.addWidget(btn_segsavedcm, rstart + 1, 1) rstart += 2 hr = QFrame() hr.setFrameShape(QFrame.HLine) grid.addWidget(hr, rstart + 0, 0, 1, 4) # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) grid.addWidget(btn_quit, rstart + 1, 1, 1, 2) cw.setLayout(grid) self.setWindowTitle('Organ Segmentation with Random Walker') self.show()
def initUI(self): cw = QWidget() self.setCentralWidget(cw) grid = QGridLayout() grid.setSpacing(10) # status bar self.statusBar().showMessage('Ready') font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) # # # # # # # # # LISA logo # font_title = QFont() # font_title.setBold(True) # font_title.setSize(24) lisa_title = QLabel('LIver Surgery Analyser') info = QLabel('Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('M. Jiřík, V. Lukeš - 2013') + '\n\nVersion: ' + self.oseg.version ) info.setFont(font_info) lisa_title.setFont(font_label) lisa_logo = QLabel() logopath = os.path.join(path_to_script, "../applications/LISA256.png") logo = QPixmap(logopath) lisa_logo.setPixmap(logo) # scaledToWidth(128)) grid.addWidget(lisa_title, 0, 1) grid.addWidget(info, 1, 1) grid.addWidget(lisa_logo, 0, 2, 2, 2) # rid.setColumnMinimumWidth(1, logo.width()/2) # rid.setColumnMinimumWidth(2, logo.width()/2) # rid.setColumnMinimumWidth(3, logo.width()/2) # # dicom reader rstart = 2 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_dcm = QLabel('DICOM reader') text_dcm.setFont(font_label) btn_dcmdir = QPushButton("Load DICOM", self) btn_dcmdir.clicked.connect(self.loadDataDir) btn_datafile = QPushButton("Load file", self) btn_datafile.clicked.connect(self.loadDataFile) btn_dcmcrop = QPushButton("Crop", self) btn_dcmcrop.clicked.connect(self.cropDcm) # voxelsize gui comment # elf.scaling_mode = 'original' # ombo_vs = QComboBox(self) # ombo_vs.activated[str].connect(self.changeVoxelSize) # eys = scaling_modes.keys() # eys.sort() # ombo_vs.addItems(keys) # ombo_vs.setCurrentIndex(keys.index(self.scaling_mode)) # elf.text_vs = QLabel('Voxel size:') # end-- voxelsize gui self.text_dcm_dir = QLabel('DICOM dir:') self.text_dcm_data = QLabel('DICOM data:') grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_dcm, rstart + 0, 1, 1, 3) grid.addWidget(btn_dcmdir, rstart + 1, 1) grid.addWidget(btn_datafile, rstart + 1, 2) grid.addWidget(btn_dcmcrop, rstart + 1, 3) # voxelsize gui comment # grid.addWidget(self.text_vs, rstart + 3, 1) # grid.addWidget(combo_vs, rstart + 4, 1) grid.addWidget(self.text_dcm_dir, rstart + 6, 1, 1, 3) grid.addWidget(self.text_dcm_data, rstart + 7, 1, 1, 3) rstart += 9 # # # # # # # # # segmentation hr = QFrame() hr.setFrameShape(QFrame.HLine) text_seg = QLabel('Segmentation') text_seg.setFont(font_label) btn_mask = QPushButton("Mask region", self) btn_mask.clicked.connect(self.maskRegion) btn_segauto = QPushButton("Automatic seg.", self) btn_segauto.clicked.connect(self.autoSeg) btn_segman = QPushButton("Manual seg.", self) btn_segman.clicked.connect(self.manualSeg) self.text_seg_data = QLabel('segmented data:') grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_seg, rstart + 0, 1) grid.addWidget(btn_mask, rstart + 1, 1) grid.addWidget(btn_segauto, rstart + 1, 2) grid.addWidget(btn_segman, rstart + 1, 3) grid.addWidget(self.text_seg_data, rstart + 2, 1, 1, 3) rstart += 3 # # # # # # # # # save/view # hr = QFrame() # hr.setFrameShape(QFrame.HLine) btn_segsave = QPushButton("Save", self) btn_segsave.clicked.connect(self.saveOut) btn_segsavedcm = QPushButton("Save Dicom", self) btn_segsavedcm.clicked.connect(self.saveOutDcm) btn_segview = QPushButton("View3D", self) if viewer3D_available: btn_segview.clicked.connect(self.view3D) else: btn_segview.setEnabled(False) grid.addWidget(btn_segsave, rstart + 0, 1) grid.addWidget(btn_segview, rstart + 0, 3) grid.addWidget(btn_segsavedcm, rstart + 0, 2) rstart += 2 # # # # Virtual resection hr = QFrame() hr.setFrameShape(QFrame.HLine) rstart += 1 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_resection = QLabel('Virtual resection') text_resection.setFont(font_label) btn_vesselseg = QPushButton("Vessel segmentation", self) btn_vesselseg.clicked.connect(self.btnVesselSegmentation) btn_lesions = QPushButton("Lesions localization", self) btn_lesions.clicked.connect(self.btnLesionLocalization) btn_resection = QPushButton("Virtual resection", self) btn_resection.clicked.connect(self.btnVirtualResection) grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_resection, rstart + 0, 1) grid.addWidget(btn_vesselseg, rstart + 1, 1) grid.addWidget(btn_lesions, rstart + 1, 2) grid.addWidget(btn_resection, rstart + 1, 3) # # # # # # # hr = QFrame() hr.setFrameShape(QFrame.HLine) # rid.addWidget(hr, rstart + 0, 0, 1, 4) rstart += 3 # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) grid.addWidget(btn_quit, rstart + 1, 1, 1, 2) cw.setLayout(grid) self.setWindowTitle('LISA') self.show()
def _initUI(self): cw = QWidget() self.setCentralWidget(cw) grid = QGridLayout() grid.setSpacing(10) self.uiw = {} # status bar self.statusBar().showMessage('Ready') # menubar self._initMenu() font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) # # # # # # # # # LISA logo # font_title = QFont() # font_title.setBold(True) # font_title.setSize(24) lisa_title = QLabel('LIver Surgery Analyser') info = QLabel('Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('M. Jiřík, V. Lukeš - 2013') + '\n\nVersion: ' + self.oseg.version ) info.setFont(font_info) lisa_title.setFont(font_label) lisa_logo = QLabel() logopath = find_logo() logo = QPixmap(logopath) lisa_logo.setPixmap(logo) # scaledToWidth(128)) grid.addWidget(lisa_title, 0, 1) grid.addWidget(info, 1, 1) btn_config = QPushButton("Configuration", self) btn_config.clicked.connect(self.btnConfig) self.uiw['config'] = btn_config grid.addWidget(btn_config, 2, 1) btn_update = QPushButton("Update", self) btn_update.clicked.connect(self.btnUpdate) self.uiw['btn_update'] = btn_update grid.addWidget(btn_update, 3, 1) grid.addWidget(lisa_logo, 0, 2, 5, 2) # combo = QtGui.QComboBox(self) # for text in self.oseg.segmentation_alternative_params.keys(): # combo.addItem(text) # combo.activated[str].connect(self.onAlternativeSegmentationParams) # grid.addWidget(combo, 4, 1) # right from logo rstart = 0 btn_sync = QPushButton("Sync", self) btn_sync.clicked.connect(self.sync_lisa_data) self.uiw['sync'] = btn_sync grid.addWidget(btn_sync, rstart + 2, 4) grid.addWidget( self._add_button("Log", self.btnLog, 'Log', "See log file", QStyle.SP_FileDialogContentsView), rstart + 3, 4) # # dicom reader rstart = 5 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_dcm = QLabel('DICOM reader') text_dcm.setFont(font_label) # btn_dcmdir = QPushButton("Load DICOM", self) # btn_dcmdir.clicked.connect(self.loadDataDir) # btn_dcmdir.setIcon(btn_dcmdir.style().standardIcon(QStyle.SP_DirOpenIcon)) # self.uiw['dcmdir'] = btn_dcmdir # btn_datafile = QPushButton("Load file", self) # btn_datafile.clicked.connect(self.loadDataFile) # btn_datafile.setToolTip("Load data from pkl file, 3D Dicom, tiff, ...") btn_dcmcrop = QPushButton("Crop", self) btn_dcmcrop.clicked.connect(self.cropDcm) # voxelsize gui comment # elf.scaling_mode = 'original' # ombo_vs = QComboBox(self) # ombo_vs.activated[str].connect(self.changeVoxelSize) # eys = scaling_modes.keys() # eys.sort() # ombo_vs.addItems(keys) # ombo_vs.setCurrentIndex(keys.index(self.scaling_mode)) # elf.text_vs = QLabel('Voxel size:') # end-- voxelsize gui self.text_dcm_dir = QLabel('DICOM dir:') self.text_dcm_data = QLabel('DICOM data:') grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_dcm, rstart + 0, 1, 1, 3) grid.addWidget( self._add_button("Load dir", self.loadDataDir, 'dcmdir', "Load data from directory (DICOM, png, jpg...)", QStyle.SP_DirOpenIcon), rstart + 1, 1) grid.addWidget( self._add_button("Load file", self.loadDataFile, 'load_file', "Load data from pkl file, 3D Dicom, tiff, ...", QStyle.SP_FileIcon), rstart + 1, 2) # grid.addWidget(btn_datafile, rstart + 1, 2) grid.addWidget(btn_dcmcrop, rstart + 1, 3) # voxelsize gui comment # grid.addWidget(self.text_vs, rstart + 3, 1) # grid.addWidget(combo_vs, rstart + 4, 1) grid.addWidget(self.text_dcm_dir, rstart + 6, 1, 1, 4) grid.addWidget(self.text_dcm_data, rstart + 7, 1, 1, 4) rstart += 9 # # # # # # # # # segmentation hr = QFrame() hr.setFrameShape(QFrame.HLine) text_seg = QLabel('Segmentation') text_seg.setFont(font_label) btn_segfile = QPushButton("Seg. from file", self) btn_segfile.clicked.connect(self.loadSegmentationFromFile) btn_segfile.setToolTip("Load segmentation from pkl file, raw, ...") btn_segcompare = QPushButton("Compare", self) btn_segcompare.clicked.connect(self.compareSegmentationWithFile) btn_segcompare.setToolTip( "Compare data with segmentation from pkl file, raw, ...") btn_mask = QPushButton("Mask region", self) btn_mask.clicked.connect(self.maskRegion) btn_segliver = QPushButton("Liver seg.", self) btn_segliver.clicked.connect(self.liverSeg) self.btn_segauto = QPushButton("Auto seg.", self) self.btn_segauto.clicked.connect(self.autoSeg) btn_segman = QPushButton("Viewer", self) btn_segman.clicked.connect(self.manualSeg) self.text_seg_data = QLabel('segmented data:') grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_seg, rstart + 0, 1) grid.addWidget(btn_segfile, rstart + 1, 1) grid.addWidget(btn_segcompare, rstart + 1, 3) grid.addWidget(btn_mask, rstart + 2, 1) grid.addWidget(btn_segliver, rstart + 2, 2) grid.addWidget(self.btn_segauto, rstart + 1, 2) grid.addWidget(btn_segman, rstart + 2, 3) grid.addWidget(self.text_seg_data, rstart + 3, 1, 1, 3) rstart += 4 # # # # # # # # # save/view # hr = QFrame() # hr.setFrameShape(QFrame.HLine) grid.addWidget( self._add_button( "Save", self.saveOut, 'save', "Save data with segmentation. Use filename 'slice{:04d}.tiff' to store slices", QStyle.SP_DialogSaveButton), rstart + 0, 1) # btn_segsave = QPushButton("Save", self) # btn_segsave.clicked.connect(self.saveOut) btn_segsavedcmoverlay = QPushButton("Save Dicom Overlay", self) btn_segsavedcmoverlay.clicked.connect(self.btnSaveOutDcmOverlay) btn_segsavedcm = QPushButton("Save Dicom", self) btn_segsavedcm.clicked.connect(self.btnSaveOutDcm) btn_segview = QPushButton("View3D", self) if viewer3D_available: btn_segview.clicked.connect(self.view3D) else: btn_segview.setEnabled(False) grid.addWidget(btn_segsavedcm, rstart + 0, 2) grid.addWidget(btn_segsavedcmoverlay, rstart + 0, 3) grid.addWidget(btn_segview, rstart + 0, 4) rstart += 1 # # # # Virtual resection hr = QFrame() hr.setFrameShape(QFrame.HLine) rstart += 1 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_resection = QLabel('Virtual resection') text_resection.setFont(font_label) btn_pvseg = QPushButton("Portal vein seg.", self) btn_pvseg.clicked.connect(self.btnPortalVeinSegmentation) btn_svpv = QPushButton("Save PV tree", self) btn_svpv.clicked.connect(self.btnSavePortalVeinTree) btn_svpv.setToolTip("Save Portal Vein 1D model into vessel_tree.yaml") # btn_svpv.setEnabled(False) btn_svpv.setEnabled(True) btn_hvseg = QPushButton("Hepatic veins seg.", self) btn_hvseg.clicked.connect(self.btnHepaticVeinsSegmentation) btn_svhv = QPushButton("Save HV tree", self) btn_svhv.clicked.connect(self.btnSaveHepaticVeinsTree) btn_svhv.setToolTip( "Save Hepatic Veins 1D model into vessel_tree.yaml") btn_svhv.setEnabled(True) # btn_svhv.setEnabled(False) btn_lesions = QPushButton("Lesions localization", self) btn_lesions.clicked.connect(self.btnLesionLocalization) # btn_lesions.setEnabled(False) grid.addWidget( self._add_button("Resection (PV)", self.btnVirtualResectionPV, 'btn_resection_pv', "Portal Vein based virtual resection"), rstart + 2, 3) grid.addWidget( self._add_button("Resection (planar)", self.btnVirtualResectionPlanar, 'btn_resection_planar', "Plane based virtual resection"), rstart + 1, 3) # btn_resection_pv = QPushButton("Resection (PV)", self) # btn_resection_pv.clicked.connect(self.btnVirtualResectionPV) # btn_resection_planar = QPushButton("Resection (planar)", self) # btn_resection_planar.clicked.connect(self.btnVirtualResectionPV) grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_resection, rstart + 0, 1) grid.addWidget(btn_pvseg, rstart + 1, 1) grid.addWidget(btn_hvseg, rstart + 1, 2) # grid.addWidget(btn_resection_planar, rstart + 1, 3) # grid.addWidget(btn_resection_pv, rstart + 2, 3) grid.addWidget(btn_lesions, rstart + 1, 4) grid.addWidget(btn_svpv, rstart + 2, 1) grid.addWidget(btn_svhv, rstart + 2, 2) # # # # # # # hr = QFrame() hr.setFrameShape(QFrame.HLine) # rid.addWidget(hr, rstart + 0, 0, 1, 4) rstart += 3 # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) grid.addWidget(btn_quit, rstart + -1, 4, 1, 1) self.uiw['quit'] = btn_quit if self.oseg.debug_mode: btn_debug = QPushButton("Debug", self) btn_debug.clicked.connect(self.run_debug) grid.addWidget(btn_debug, rstart - 2, 4) cw.setLayout(grid) self.cw = cw self.grid = grid self.setWindowTitle('LISA') self.show()
def initUI(self): import os.path as op path_to_script = op.dirname(os.path.abspath(__file__)) cw = QWidget() self.setCentralWidget(cw) vbox = QVBoxLayout() vbox.setSpacing(10) # status bar self.statusBar().showMessage('Ready') # info panel font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) dicom2fem_title = QLabel('DICOM2FEM') info = QLabel('Version: 0.9\n\n' + 'Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('V. Lukeš - 2014') + '\n\nBased on PYSEG_BASE project' ) info.setFont(font_info) dicom2fem_title.setFont(font_label) dicom2fem_logo = QLabel() logopath = os.path.join(path_to_script, "../src/brain.png") logo = QPixmap(logopath) dicom2fem_logo.setPixmap(logo) vbox1 = QVBoxLayout() vbox1.addWidget(dicom2fem_title) vbox1.addWidget(info) vbox1.addStretch(1) vbox2 = QVBoxLayout() vbox2.addWidget(dicom2fem_logo) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addLayout(vbox1) hbox.addStretch(1) hbox.addLayout(vbox2) hbox.addStretch(1) vbox.addLayout(hbox) tabs = QTabWidget() tab1 = QWidget() tab2 = QWidget() tab3 = QWidget() tab1.setLayout(self.init_ReaderTab()) tab2.setLayout(self.init_SegmentationTab()) tab3.setLayout(self.init_MeshGenTab()) tabs.addTab(tab1,"DICOM Reader") tabs.addTab(tab2,"Segmentation") tabs.addTab(tab3,"Mesh generator") vbox.addWidget(tabs) # clear, quit hbox = QHBoxLayout() hbox.addStretch(1) btn_clear = QPushButton("Clear", self) btn_clear.clicked.connect(self.clearall) hbox.addWidget(btn_clear) btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) hbox.addWidget(btn_quit) hbox.addStretch(1) vbox.addLayout(hbox) cw.setLayout(vbox) self.setWindowTitle('DICOM2FEM') self.show()
def initUI(self): cw = QWidget() self.setCentralWidget(cw) grid = QGridLayout() grid.setSpacing(10) self.uiw = {} # status bar self.statusBar().showMessage("Ready") font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) # # # # # # # # # LISA logo # font_title = QFont() # font_title.setBold(True) # font_title.setSize(24) lisa_title = QLabel("LIver Surgery Analyser") info = QLabel( "Developed by:\n" + "University of West Bohemia\n" + "Faculty of Applied Sciences\n" + QString.fromUtf8("M. Jiřík, V. Lukeš - 2013") + "\n\nVersion: " + self.oseg.version ) info.setFont(font_info) lisa_title.setFont(font_label) lisa_logo = QLabel() logopath = os.path.join(path_to_script, "../applications/LISA256.png") logo = QPixmap(logopath) lisa_logo.setPixmap(logo) # scaledToWidth(128)) grid.addWidget(lisa_title, 0, 1) grid.addWidget(info, 1, 1) btn_config = QPushButton("Configuration", self) btn_config.clicked.connect(self.btnConfig) self.uiw["dcmdir"] = btn_config grid.addWidget(btn_config, 2, 1) grid.addWidget(lisa_logo, 0, 2, 3, 2) # rid.setColumnMinimumWidth(1, logo.width()/2) # rid.setColumnMinimumWidth(2, logo.width()/2) # rid.setColumnMinimumWidth(3, logo.width()/2) # # dicom reader rstart = 3 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_dcm = QLabel("DICOM reader") text_dcm.setFont(font_label) btn_dcmdir = QPushButton("Load DICOM", self) btn_dcmdir.clicked.connect(self.loadDataDir) self.uiw["dcmdir"] = btn_dcmdir btn_datafile = QPushButton("Load file", self) btn_datafile.clicked.connect(self.loadDataFile) btn_datafile.setToolTip("Load data from pkl file, 3D Dicom, tiff, ...") btn_dcmcrop = QPushButton("Crop", self) btn_dcmcrop.clicked.connect(self.cropDcm) # voxelsize gui comment # elf.scaling_mode = 'original' # ombo_vs = QComboBox(self) # ombo_vs.activated[str].connect(self.changeVoxelSize) # eys = scaling_modes.keys() # eys.sort() # ombo_vs.addItems(keys) # ombo_vs.setCurrentIndex(keys.index(self.scaling_mode)) # elf.text_vs = QLabel('Voxel size:') # end-- voxelsize gui self.text_dcm_dir = QLabel("DICOM dir:") self.text_dcm_data = QLabel("DICOM data:") grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_dcm, rstart + 0, 1, 1, 3) grid.addWidget(btn_dcmdir, rstart + 1, 1) grid.addWidget(btn_datafile, rstart + 1, 2) grid.addWidget(btn_dcmcrop, rstart + 1, 3) # voxelsize gui comment # grid.addWidget(self.text_vs, rstart + 3, 1) # grid.addWidget(combo_vs, rstart + 4, 1) grid.addWidget(self.text_dcm_dir, rstart + 6, 1, 1, 3) grid.addWidget(self.text_dcm_data, rstart + 7, 1, 1, 3) rstart += 9 # # # # # # # # # segmentation hr = QFrame() hr.setFrameShape(QFrame.HLine) text_seg = QLabel("Segmentation") text_seg.setFont(font_label) btn_segfile = QPushButton("Seg. from file", self) btn_segfile.clicked.connect(self.loadSegmentationFromFile) btn_segfile.setToolTip("Load segmentation from pkl file, raw, ...") btn_segcompare = QPushButton("Compare", self) btn_segcompare.clicked.connect(self.compareSegmentationWithFile) btn_segcompare.setToolTip("Compare data with segmentation from pkl file, raw, ...") btn_mask = QPushButton("Mask region", self) btn_mask.clicked.connect(self.maskRegion) btn_segliver = QPushButton("Liver seg.", self) btn_segliver.clicked.connect(self.liverSeg) self.btn_segauto = QPushButton("Auto seg.", self) self.btn_segauto.clicked.connect(self.autoSeg) btn_segman = QPushButton("Manual seg.", self) btn_segman.clicked.connect(self.manualSeg) self.text_seg_data = QLabel("segmented data:") grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_seg, rstart + 0, 1) grid.addWidget(btn_segfile, rstart + 1, 1) grid.addWidget(btn_segcompare, rstart + 1, 3) grid.addWidget(btn_mask, rstart + 2, 1) grid.addWidget(btn_segliver, rstart + 2, 2) grid.addWidget(self.btn_segauto, rstart + 1, 2) grid.addWidget(btn_segman, rstart + 2, 3) grid.addWidget(self.text_seg_data, rstart + 3, 1, 1, 3) rstart += 4 # # # # # # # # # save/view # hr = QFrame() # hr.setFrameShape(QFrame.HLine) btn_segsave = QPushButton("Save", self) btn_segsave.clicked.connect(self.saveOut) btn_segsavedcmoverlay = QPushButton("Save Dicom Overlay", self) btn_segsavedcmoverlay.clicked.connect(self.btnSaveOutDcmOverlay) btn_segsavedcm = QPushButton("Save Dicom", self) btn_segsavedcm.clicked.connect(self.btnSaveOutDcm) btn_segview = QPushButton("View3D", self) if viewer3D_available: btn_segview.clicked.connect(self.view3D) else: btn_segview.setEnabled(False) grid.addWidget(btn_segsave, rstart + 0, 1) grid.addWidget(btn_segview, rstart + 0, 3) grid.addWidget(btn_segsavedcm, rstart + 0, 2) grid.addWidget(btn_segsavedcmoverlay, rstart + 1, 2) rstart += 2 # # # # Virtual resection hr = QFrame() hr.setFrameShape(QFrame.HLine) rstart += 1 hr = QFrame() hr.setFrameShape(QFrame.HLine) text_resection = QLabel("Virtual resection") text_resection.setFont(font_label) btn_pvseg = QPushButton("Portal vein seg.", self) btn_pvseg.clicked.connect(self.btnPortalVeinSegmentation) btn_svpv = QPushButton("Save PV tree", self) btn_svpv.clicked.connect(self.btnSavePortalVeinTree) btn_svpv.setToolTip("Save Portal Vein 1D model into vessel_tree.yaml") btn_svpv.setEnabled(False) btn_hvseg = QPushButton("Hepatic veins seg.", self) btn_hvseg.clicked.connect(self.btnHepaticVeinsSegmentation) btn_svhv = QPushButton("Save HV tree", self) btn_svhv.clicked.connect(self.btnSaveHepaticVeinsTree) btn_svhv.setToolTip("Save Hepatic Veins 1D model into vessel_tree.yaml") btn_svhv.setEnabled(False) btn_lesions = QPushButton("Lesions localization", self) btn_lesions.clicked.connect(self.btnLesionLocalization) # @TODO make button active by removing next line btn_lesions.setEnabled(False) btn_resection = QPushButton("Virtual resection", self) btn_resection.clicked.connect(self.btnVirtualResection) grid.addWidget(hr, rstart + 0, 2, 1, 4) grid.addWidget(text_resection, rstart + 0, 1) grid.addWidget(btn_pvseg, rstart + 1, 1) grid.addWidget(btn_hvseg, rstart + 1, 2) grid.addWidget(btn_lesions, rstart + 1, 3) grid.addWidget(btn_resection, rstart + 2, 3) grid.addWidget(btn_svpv, rstart + 2, 1) grid.addWidget(btn_svhv, rstart + 2, 2) # # # # # # # hr = QFrame() hr.setFrameShape(QFrame.HLine) # rid.addWidget(hr, rstart + 0, 0, 1, 4) rstart += 3 # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) grid.addWidget(btn_quit, rstart + 1, 1, 1, 2) self.uiw["quit"] = btn_quit if self.oseg.debug_mode: btn_debug = QPushButton("Debug", self) btn_debug.clicked.connect(self.run_debug) grid.addWidget(btn_debug, rstart + 1, 3) cw.setLayout(grid) self.cw = cw self.grid = grid self.setWindowTitle("LISA") self.show()
def initUI(self): import os.path as op path_to_script = op.dirname(os.path.abspath(__file__)) cw = QWidget() self.setCentralWidget(cw) vbox = QVBoxLayout() vbox.setSpacing(10) # status bar self.statusBar().showMessage('Ready') # info panel font_label = QFont() font_label.setBold(True) font_info = QFont() font_info.setItalic(True) font_info.setPixelSize(10) dicom2fem_title = QLabel('DICOM2FEM') info = QLabel('Version: 0.9\n\n' + 'Developed by:\n' + 'University of West Bohemia\n' + 'Faculty of Applied Sciences\n' + QString.fromUtf8('V. Lukeš - 2014') + '\n\nBased on PYSEG_BASE project') info.setFont(font_info) dicom2fem_title.setFont(font_label) dicom2fem_logo = QLabel() logopath = os.path.join(path_to_script, "../src/brain.png") logo = QPixmap(logopath) dicom2fem_logo.setPixmap(logo) vbox1 = QVBoxLayout() vbox1.addWidget(dicom2fem_title) vbox1.addWidget(info) vbox1.addStretch(1) vbox2 = QVBoxLayout() vbox2.addWidget(dicom2fem_logo) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addLayout(vbox1) hbox.addStretch(1) hbox.addLayout(vbox2) hbox.addStretch(1) vbox.addLayout(hbox) tabs = QTabWidget() tab1 = QWidget() tab2 = QWidget() tab3 = QWidget() tab1.setLayout(self.init_ReaderTab()) tab2.setLayout(self.init_SegmentationTab()) tab3.setLayout(self.init_MeshGenTab()) tabs.addTab(tab1, "DICOM Reader") tabs.addTab(tab2, "Segmentation") tabs.addTab(tab3, "Mesh generator") vbox.addWidget(tabs) # quit btn_quit = QPushButton("Quit", self) btn_quit.clicked.connect(self.quit) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(btn_quit) hbox.addStretch(1) vbox.addLayout(hbox) cw.setLayout(vbox) self.setWindowTitle('DICOM2FEM') self.show()