def showReconstruct(self): ''' load window for reconstruction window ''' self.write = xrftomo.SaveOptions() self.actions.x_shifts = self.x_shifts self.actions.y_shifts = self.y_shifts self.actions.centers = self.centers self.y_range = self.data.shape[2] self.ViewControl.combo1.clear() self.ViewControl.method.clear() methodname = [ "mlem", "gridrec", "art", "pml_hybrid", "pml_quad", "fbp", "sirt", "tv" ] for j in self.elements: self.ViewControl.combo1.addItem(j) for k in arange(len(methodname)): self.ViewControl.method.addItem(methodname[k]) self.elementChanged() # self.ViewControl.centerTextBox.setText(str(self.centers[2])) self.ViewControl.mulBtn.setEnabled(False) self.ViewControl.divBtn.setEnabled(False) self.ViewControl.end_indx.setText((str(self.data.shape[2]))) self.sld.setRange(0, self.y_range - 1) self.lcd.display(0)
def showReconstruct(self): ''' load window for reconstruction window ''' self.write = xrftomo.SaveOptions() self.actions.x_shifts = self.x_shifts self.actions.y_shifts = self.y_shifts self.actions.centers = self.centers self.y_range = self.data.shape[2] self.ViewControl.combo1.clear() self.ViewControl.method.clear() self.ViewControl.reconGroup.clear() self.ViewControl.reconGroup.disconnect() methodname = [ "mlem", "gridrec", "art", "pml_hybrid", "pml_quad", "fbp", "sirt", "tv" ] for j in self.elements: self.ViewControl.combo1.addItem(j) for k in range(len(methodname)): self.ViewControl.method.addItem(methodname[k]) for l in self.elements: self.ViewControl.reconGroup.addItem(l) self.recon_array = np.zeros((len(self.elements), self.y_range, self.data.shape[3], self.data.shape[3])) self.ViewControl.reconGroup.currentIndexChanged.connect( self.recon_combobox_changed) self.elementChanged() #TODO: recon_array will need to update with any changes to data dimensions as well as re-initialization # self.ViewControl.centerTextBox.setText(str(self.centers[2])) self.ViewControl.mulBtn.setEnabled(False) self.ViewControl.divBtn.setEnabled(False) self.ViewControl.end_indx.setText((str(self.data.shape[2]))) self.ViewControl.mid_indx.setText((str(self.data.shape[2] // 2))) self.sld.setRange(0, self.y_range - 1) self.lcd.display(0)
def initUI(self): exitAction = QtGui.QAction('Exit', self) exitAction.triggered.connect(self.close) exitAction.setShortcut('Ctrl+Q') closeAction = QtGui.QAction('Quit', self) closeAction.triggered.connect(sys.exit) closeAction.setShortcut('Ctrl+X') openH5Action = QtGui.QAction('open h5 file', self) openH5Action.triggered.connect(self.openH5) openExchangeAction = QtGui.QAction('open exchange file', self) openExchangeAction.triggered.connect(self.openExchange) openTiffAction = QtGui.QAction('open tiff files', self) openTiffAction.triggered.connect(self.openTiffs) openThetaAction = QtGui.QAction('open thetas file', self) openThetaAction.triggered.connect(self.openThetas) #openTiffFolderAction = QtGui.QAction("Open Tiff Folder", self) #openTiffFolderAction.triggered.connect(self.openTiffFolder) saveProjectionAction = QtGui.QAction('Projections', self) saveProjectionAction.triggered.connect(self.saveProjections) # saveHotSpotPosAction = QtGui.QAction('save hotspot positions',self) # saveHotSpotPosAction.triggered.connect(self.save_hotspot_positions) saveSinogramAction = QtGui.QAction('Sinogram', self) saveSinogramAction.triggered.connect(self.saveSinogram) saveSinogram2Action = QtGui.QAction('Sinogram stack', self) saveSinogram2Action.triggered.connect(self.saveSinogram2) saveReconstructionAction = QtGui.QAction('Reconstruction', self) saveReconstructionAction.triggered.connect(self.saveReconstruction) saveToHDFAction = QtGui.QAction('as HDF file', self) saveToHDFAction.triggered.connect(self.saveToHDF) saveThetasAction = QtGui.QAction('Angle information to .txt', self) saveThetasAction.triggered.connect(self.saveThetas) saveToNumpyAction = QtGui.QAction("as Numpy file", self) saveToNumpyAction.triggered.connect(self.saveToNumpy) saveAlignemtInfoAction = QtGui.QAction("Alignment", self) saveAlignemtInfoAction.triggered.connect(self.saveAlignemnt) saveCorrAnalysisAction = QtGui.QAction("Corelation Analysis", self) saveCorrAnalysisAction.triggered.connect(self.saveCorrAlsys) runTransRecAction = QtGui.QAction("Transmission Recon", self) #runTransRecAction.triggered.connect(self.runTransReconstruct) # selectImageTagAction = QtGui.QAction("Select Image Tag", self) #selectImageTagAction.triggered.connect(self.selectImageTag) undoAction = QtGui.QAction('Undo (Ctrl+Z)', self) undoAction.triggered.connect(self.undo) undoAction.setShortcut('Ctrl+Z') preferencesAction = QtGui.QAction("exit preferences") restoreAction = QtGui.QAction("Restore", self) restoreAction.triggered.connect(self.restore) keyMapAction = QtGui.QAction('key map settings', self) keyMapAction.triggered.connect(self.keyMapSettings) configAction = QtGui.QAction('load configuration settings', self) configAction.triggered.connect(self.configSettings) # matcherAction = QtGui.QAction("match template", self) #matcherAction.triggered.connect(self.match_window) # saveHotSpotPosAction = QtGui.QAction("Save Hot Spot Pos", self) #saveHotSpotPosAction.triggered.connect(self.saveHotSpotPos) wienerAction = QtGui.QAction("Wiener", self) #wienerAction.triggered.connect(self.ipWiener) # externalImageRegAction = QtGui.QAction("External Image Registaration", self) #externalImageRegAction.triggered.connect(self.externalImageReg) ### self.frame = QtWidgets.QFrame() self.vl = QtWidgets.QVBoxLayout() # theta_auto_completes = seshowImgProcesslf.config.get(STR_CONFIG_THETA_STRS) # theta_auto_completes = self.params.theta_pv # if theta_auto_completes is None: # theta_auto_completes = [] self.fileTableWidget = xrftomo.FileTableWidget(self) self.imageProcessWidget = xrftomo.ImageProcessWidget() self.sinogramWidget = xrftomo.SinogramWidget() self.reconstructionWidget = xrftomo.ReconstructionWidget() self.writer = xrftomo.SaveOptions() #refresh UI self.imageProcessWidget.refreshSig.connect(self.refreshUI) #sinogram changed self.sinogramWidget.sinoChangedSig.connect(self.update_sino) #slider change self.imageProcessWidget.sliderChangedSig.connect( self.imageProcessWidget.updateSliderSlot) #element dropdown change self.imageProcessWidget.elementChangedSig.connect( self.sinogramWidget.updateElementSlot) self.sinogramWidget.elementChangedSig.connect( self.reconstructionWidget.updateElementSlot) self.reconstructionWidget.elementChangedSig.connect( self.imageProcessWidget.updateElementSlot) # data update self.imageProcessWidget.dataChangedSig.connect(self.update_history) self.sinogramWidget.dataChangedSig.connect(self.update_history) # theta update self.imageProcessWidget.thetaChangedSig.connect(self.update_theta) self.imageProcessWidget.thetaChangedSig.connect( self.sinogramWidget.updateImgSldRange) #data dimensions changed # self.imageProcessWidget.ySizeChangedSig.connect(self.imageProcessWidget.ySizeChanged) # self.imageProcessWidget.ySizeChangedSig.connect(self.sinogramWidget.ySizeChanged) # self.imageProcessWidget.ySizeChangedSig.connect(self.reconstructionWidget.ySizeChanged) #alignment changed self.imageProcessWidget.alignmentChangedSig.connect( self.update_alignment) self.sinogramWidget.alignmentChangedSig.connect(self.update_alignment) self.sinogramWidget.restoreSig.connect(self.restore) #fnames changed self.imageProcessWidget.fnamesChanged.connect(self.update_filenames) #update_reconstructed_data self.reconstructionWidget.reconChangedSig.connect(self.update_recon) self.prevTab = 0 self.TAB_FILE = 0 self.TAB_IMAGE_PROC = 1 self.TAB_SINOGRAM = 2 self.TAB_RECONSTRUCTION = 3 self.tab_widget = QtWidgets.QTabWidget() self.tab_widget.addTab(self.fileTableWidget, 'Files') self.tab_widget.addTab(self.imageProcessWidget, "Pre Processing") self.tab_widget.addTab(self.sinogramWidget, "Alignment") self.tab_widget.addTab(self.reconstructionWidget, "Reconstruction") self.tab_widget.setTabEnabled(1, False) self.tab_widget.setTabEnabled(2, False) self.tab_widget.setTabEnabled(3, False) self.tab_widget.currentChanged.connect(self.onTabChanged) self.fileTableWidget.saveDataBtn.clicked.connect(self.updateImages) self.vl.addWidget(self.tab_widget) #self.vl.addWidget(self.createMessageWidget()) self.frame.setLayout(self.vl) self.setCentralWidget(self.frame) ## Top menu bar [file Convert Option Alignment After saving in memory] menubar = self.menuBar() menubar.setNativeMenuBar(True) self.fileMenu = menubar.addMenu('&File') self.fileMenu.addAction(openH5Action) self.fileMenu.addAction(openExchangeAction) self.fileMenu.addAction(openTiffAction) self.fileMenu.addAction(openThetaAction) ##self.fileMenu.addAction(openFileAction) #self.fileMenu.addAction(openFolderAction) #self.fileMenu.addAction(openTiffFolderAction) self.fileMenu.addAction(exitAction) self.fileMenu.addAction(closeAction) self.editMenu = menubar.addMenu("Edit") self.editMenu.addAction(undoAction) self.editMenu.addAction(preferencesAction) # self.editMenu.addAction(matcherAction) # self.editMenu.addAction(saveHotSpotPosAction) # self.editMenu.addAction(alignHotSpotPosAction) # self.editMenu.addAction(externalImageRegAction) self.editMenu.addAction(restoreAction) self.editMenu.setDisabled(True) analysis = QtGui.QMenu('Analysis', self) corrElemAction = QtGui.QAction('Correlate Elements', self) analysis.addAction(corrElemAction) corrElemAction.triggered.connect(self.corrElem) self.toolsMenu = menubar.addMenu("Tools") self.toolsMenu.addMenu(analysis) self.toolsMenu.setDisabled(True) self.afterConversionMenu = menubar.addMenu('Save') self.afterConversionMenu.addAction(saveProjectionAction) # self.afterConversionMenu.addAction(saveHotSpotPosAction) self.afterConversionMenu.addAction(saveReconstructionAction) self.afterConversionMenu.addAction(saveAlignemtInfoAction) self.afterConversionMenu.addAction(saveSinogramAction) self.afterConversionMenu.addAction(saveSinogram2Action) self.afterConversionMenu.addAction(saveThetasAction) self.afterConversionMenu.addAction(saveToHDFAction) self.afterConversionMenu.addAction(saveToNumpyAction) self.afterConversionMenu.addAction(saveCorrAnalysisAction) self.helpMenu = menubar.addMenu('&Help') self.helpMenu.addAction(keyMapAction) self.helpMenu.addAction(configAction) self.afterConversionMenu.setDisabled(True) add = 0 if sys.platform == "win32": add = 50 self.setGeometry(add, add, 1100 + add, 500 + add) self.setWindowTitle('xrftomo') self.show() #_______________________Help/config_options______________________ self.config_options = QtWidgets.QWidget() self.config_options.resize(300, 400) self.config_options.setWindowTitle('config options') self.legacy_chbx = QtWidgets.QCheckBox("Load as legacy data") self.directory_chbx = QtWidgets.QCheckBox("Load last directory") self.element_chbx = QtWidgets.QCheckBox("Load last elements") self.image_tag_chbx = QtWidgets.QCheckBox("Load last image_tag") self.data_tag_chbx = QtWidgets.QCheckBox("Load last data_tag") self.alingmen_chbx = QtWidgets.QCheckBox("Load alignment information") self.iter_align_param_chbx = QtWidgets.QCheckBox( "Load last iter-align parameters") self.recon_method_chbx = QtWidgets.QCheckBox( "Load last-used reconstruction method") self.checkbox_states = eval(self.params.load_settings) self.legacy_chbx.setChecked(self.checkbox_states[0]) self.directory_chbx.setChecked(self.checkbox_states[1]) self.element_chbx.setChecked(self.checkbox_states[2]) self.image_tag_chbx.setChecked(self.checkbox_states[3]) self.data_tag_chbx.setChecked(self.checkbox_states[4]) self.alingmen_chbx.setChecked(self.checkbox_states[5]) self.iter_align_param_chbx.setChecked(self.checkbox_states[6]) self.recon_method_chbx.setChecked(self.checkbox_states[7]) self.toggleDebugMode() self.legacy_chbx.stateChanged.connect(self.loadSettingsChanged) self.legacy_chbx.stateChanged.connect(self.refresh_filetable) self.directory_chbx.stateChanged.connect(self.loadSettingsChanged) self.element_chbx.stateChanged.connect(self.loadSettingsChanged) self.image_tag_chbx.stateChanged.connect(self.loadSettingsChanged) self.data_tag_chbx.stateChanged.connect(self.loadSettingsChanged) self.alingmen_chbx.stateChanged.connect(self.loadSettingsChanged) self.iter_align_param_chbx.stateChanged.connect( self.loadSettingsChanged) self.recon_method_chbx.stateChanged.connect(self.loadSettingsChanged) vbox = QtWidgets.QVBoxLayout() vbox.addWidget(self.legacy_chbx) vbox.addWidget(self.directory_chbx) vbox.addWidget(self.element_chbx) vbox.addWidget(self.image_tag_chbx) vbox.addWidget(self.data_tag_chbx) vbox.addWidget(self.alingmen_chbx) vbox.addWidget(self.iter_align_param_chbx) vbox.addWidget(self.recon_method_chbx) self.config_options.setLayout(vbox) #_______________________Help/keymap_options______________________ self.keymap_options = QtWidgets.QWidget() self.keymap_options.resize(600, 400) self.keymap_options.setWindowTitle('key map') text = QtWidgets.QLabel( "Undo: \t\t Ctr+Z \t\t previous image: \t A \n\n" "shift image up: \t up \t\t next image: \t D \n\n" "shift image down: \t down \t\t skip (hotspot): \t S \n\n" "shift image left: \t left \t\t next (hotspot): \t N \n\n" "shift image right: \t right \n\n" "shift stack up: \t Shift + up \n\n" "shift stack down: \t Shift + down \n\n" "shift stack left: \t Shift + left \n\n" "shift stack right: \t Shift + right \n\n" "exclude image: \t Delete \n\n" "copy background: \t Ctrl + C \n\npaste background: Ctrl + V") vbox = QtWidgets.QVBoxLayout() vbox.addWidget(text) self.keymap_options.setLayout(vbox)
def __init__(self): super(ReconstructionActions, self).__init__() self.writer = xrftomo.SaveOptions()
def initUI(self): self.ViewControl = xrftomo.ReconstructionControlsWidget() self.ReconView = xrftomo.ReconView(self) self.actions = xrftomo.ReconstructionActions() self.actions2 = xrftomo.ImageProcessActions() self.writer = xrftomo.SaveOptions() self.file_name_title = QtWidgets.QLabel("_") lbl1 = QtWidgets.QLabel("x pos:") self.lbl2 = QtWidgets.QLabel("") lbl3 = QtWidgets.QLabel("y pos:") self.lbl4 = QtWidgets.QLabel("") lbl5 = QtWidgets.QLabel("Slice") lbl6 = QtWidgets.QLabel("value:") self.lbl7 = QtWidgets.QLabel("") self.ReconView.mouseMoveSig.connect(self.updatePanel) #get pixel value from Histogram widget's projview self.sld = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.lcd = QtWidgets.QLCDNumber(self) self.hist = pyqtgraph.HistogramLUTWidget() self.hist.setMinimumSize(120, 120) self.hist.setMaximumWidth(120) self.hist.setImageItem(self.ReconView.projView) self.ViewControl.combo1.currentIndexChanged.connect( self.elementChanged) self.ViewControl.reconGroup.currentIndexChanged.connect( self.recon_combobox_changed) self.ViewControl.btn.clicked.connect(self.reconstruct_params) self.ViewControl.equalizeBtn.clicked.connect(self.equalize_params) self.ViewControl.rmHotspotBtn.clicked.connect(self.rm_hotspot_params) self.ViewControl.setThreshBtn.clicked.connect(self.set_thresh_params) self.ViewControl.btn2.clicked.connect(self.reconstruct_all_params) self.ViewControl.recon2npy.clicked.connect( self.reconstruct_all_npy_params) self.ViewControl.mulBtn.clicked.connect(self.call_reconMultiply) self.ViewControl.divBtn.clicked.connect(self.call_reconDivide) self.ViewControl.end_indx.editingFinished.connect(self.update_y_range) self.ViewControl.start_indx.editingFinished.connect( self.update_y_range) self.ViewControl.mid_indx.editingFinished.connect( self.update_middle_index) self.ViewControl.recon_stats.clicked.connect(self.toggle_middle_index) self.sld.valueChanged.connect(self.update_recon_image) self.x_shifts = None self.y_shifts = None self.centers = None self.recon = None self.recon_array = None self.data = None self.data_original = None hb0 = QtWidgets.QHBoxLayout() hb0.addWidget(lbl1) hb0.addWidget(self.lbl2) hb0.addWidget(lbl3) hb0.addWidget(self.lbl4) hb0.addWidget(lbl6) hb0.addWidget(self.lbl7) hb1 = QtWidgets.QHBoxLayout() hb1.addWidget(lbl5) hb1.addWidget(self.lcd) hb1.addWidget(self.sld) vb1 = QtWidgets.QVBoxLayout() vb1.addWidget(self.file_name_title) vb1.addLayout(hb0) vb1.addWidget(self.ReconView) vb1.addLayout(hb1) hb2 = QtWidgets.QHBoxLayout() hb2.addWidget(self.ViewControl) hb2.addLayout(vb1) hb2.addWidget(self.hist, 10) self.setLayout(hb2)