Beispiel #1
0
    def __init__(self, parent=None):
        DataWindow.__init__(self, parent)
        self.plot = pyqtgraph.PlotWidget(self.plotFrame, antialiasing=True)
        self.plot.hideAxis('bottom')
        self.legend = self.plot.addLegend()
        self.legend.hide()
        self._finish_layout()
        self.actionLegend_Box.triggered.connect(self.on_view_legend_box)
        self.actionX_axis.triggered.connect(self.on_view_x_axis)
        self.actionY_axis.triggered.connect(self.on_view_y_axis)
        self.exclusive_source = False
        self.line_colors = [(252, 175, 62), (114, 159, 207), (255, 255, 255),
                            (239, 41, 41), (138, 226, 52), (173, 127, 168)]
        self.colorbar = None
        self.colormap = None
        self.current_index = -1
        self.last_vector_y = {}
        self.last_vector_x = None
        self.hline = None
        self.vline = None
        self.hline_color = (0, 204, 0)
        self.vline_color = (204, 0, 0)
        self._settings_diag = LinePlotSettings(self)
        self._histograms = {}
        self._normalized_histograms = {}
        self.updateFonts()

        self.plot.scene().sigMouseMoved.connect(self._onMouseMoved)

        # Make sure menubar is attached to the main window
        self.menubar = self.menuBar()
        self.menubar.setNativeMenuBar(False)
        self.time_on_x_axis = False
        self.time_axis = DateAxisItem(orientation='bottom')
Beispiel #2
0
    def __init__(self, parent=None):
        DataWindow.__init__(self, parent)
        self.plot = pyqtgraph.PlotWidget(self.plotFrame, antialiasing=True)
        self.plot.hideAxis('bottom')
        self.legend = self.plot.addLegend()
        self.legend.hide()
        self._finish_layout()
        self.actionLegend_Box.triggered.connect(self.on_view_legend_box)
        self.actionX_axis.triggered.connect(self.on_view_x_axis)
        self.actionY_axis.triggered.connect(self.on_view_y_axis)
        self.acceptable_data_types = ['scalar', 'vector', 'tuple', 'triple', 'running_hist', 'histogram' ]
        self.exclusive_source = False
        self.line_colors = [(252, 175, 62), (114, 159, 207), (255, 255, 255),
                            (239, 41, 41), (138, 226, 52), (173, 127, 168)]
        self.colorbar = None
        self.colormap = None
        self.current_index = -1
        self.last_vector_y = {}
        self.last_vector_x = None
        self.hline = None
        self.vline = None
        self.hline_color = (0,204,0)
        self.vline_color = (204,0,0)
        self._settings_diag = LinePlotSettings(self)
        self._histograms = {}        
        self.updateFonts()

        self.plot.scene().sigMouseMoved.connect(self._onMouseMoved)
    def __init__(self, parent=None):
        DataWindow.__init__(self, parent)
        self.plot = pyqtgraph.PlotWidget(self.plotFrame, antialiasing=True)
        self.plot.hideAxis('bottom')
        self.legend = self.plot.addLegend()
        self.legend.hide()
        self._finish_layout()
        self.actionLegend_Box.triggered.connect(self.on_view_legend_box)
        self.actionX_axis.triggered.connect(self.on_view_x_axis)
        self.actionY_axis.triggered.connect(self.on_view_y_axis)
        self.acceptable_data_types = ['scalar', 'vector', 'tuple', 'triple', 'running_hist', 'histogram' , 'normalized_histogram']
        self.exclusive_source = False
        self.line_colors = [(252, 175, 62), (114, 159, 207), (255, 255, 255),
                            (239, 41, 41), (138, 226, 52), (173, 127, 168)]
        self.colorbar = None
        self.colormap = None
        self.current_index = -1
        self.last_vector_y = {}
        self.last_vector_x = None
        self.hline = None
        self.vline = None
        self.hline_color = (0,204,0)
        self.vline_color = (204,0,0)
        self._settings_diag = LinePlotSettings(self)
        self._histograms = {}
        self._normalized_histograms = {}
        self.updateFonts()

        self.plot.scene().sigMouseMoved.connect(self._onMouseMoved)
Beispiel #4
0
    def __init__(self, parent=None):
        # This also sets up the UI part
        DataWindow.__init__(self, parent)
        # This is imported here to prevent problems with sphinx
        from .image_view import ImageView

        self.plot = ImageView(self, view=pyqtgraph.PlotItem())
        self._finish_layout()
        self.infoLabel.setText("")
        self.acceptable_data_types = ["image", "vector", "triple", "running_hist"]
        self.exclusive_source = True
        self.alert = False
        self.meanmap = None
        self.vline = None
        self.hline = None

        self.settingsWidget.setVisible(self.actionPlotSettings.isChecked())
        self.settingsWidget.ui.colormap_min.editingFinished.connect(self.set_colormap_range)
        self.settingsWidget.ui.colormap_max.editingFinished.connect(self.set_colormap_range)
        self.settingsWidget.ui.colormap_min.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_max.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_full_range.clicked.connect(self.set_colormap_full_range)

        self.settingsWidget.ui.histogram_show.toggled.connect(self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(self.settingsWidget.ui.histogram_show.setChecked)
        self.settingsWidget.ui.histogram_show.toggled.connect(self.actionHistogram.setChecked)

        self.settingsWidget.ui.x_show.toggled.connect(self.toggle_axis)
        self.actionX_axis.triggered.connect(self.toggle_axis)
        self.settingsWidget.ui.y_show.toggled.connect(self.toggle_axis)
        self.actionY_axis.triggered.connect(self.toggle_axis)
        self.settingsWidget.ui.histogram_show.toggled.connect(self.toggle_axis)
        self.actionHistogram.triggered.connect(self.toggle_axis)

        self.set_sounds_and_volume()
        self.actionSound_on_off.triggered.connect(self.toggle_alert)

        self.plot.getHistogramWidget().region.sigRegionChangeFinished.connect(self.set_colormap_range)
        self.actionPlotSettings.triggered.connect(self.toggle_settings)

        # Make sure to disable native menus
        self.plot.getView().setMenuEnabled(False)
        self.plot.getHistogramWidget().vb.setMenuEnabled(False)
        self.x_axis_name = "left"
        self.y_axis_name = "bottom"
        self._set_logscale_lookuptable()

        self.running_hist_initialised = False
    def get_state(self, _settings=None):
        """Returns settings that can be used to restore the widget to the current state"""
        settings = _settings or {}
        settings['window_type'] = 'ImageWindow'
        settings['actionPlotSettings'] = self.actionPlotSettings.isChecked()
        # Disabled QLineEdits are confusing to QSettings. Store a dummy _
        settings['x_label'] = "_" + self.settingsWidget.ui.x_label.text()
        settings['y_label'] = "_" + self.settingsWidget.ui.y_label.text()
        settings[
            'x_label_auto'] = self.settingsWidget.ui.x_label_auto.isChecked()
        settings[
            'y_label_auto'] = self.settingsWidget.ui.y_label_auto.isChecked()
        settings['colormap_min'] = str(
            self.settingsWidget.ui.colormap_min.text())
        settings['colormap_max'] = str(
            self.settingsWidget.ui.colormap_max.text())
        settings['transpose'] = self.settingsWidget.ui.transpose.currentText()
        settings['flipx'] = self.settingsWidget.ui.flipx.currentText()
        settings['flipy'] = self.settingsWidget.ui.flipy.currentText()
        settings['viewbox'] = self.plot.getView().getViewBox().getState()
        settings['x_view'] = self.actionX_axis.isChecked()
        settings['y_view'] = self.actionY_axis.isChecked()
        settings['histogram_view'] = self.actionHistogram.isChecked()
        settings['crosshair'] = self.actionCrosshair.isChecked()
        settings['gradient_mode'] = self.plot.getHistogramWidget(
        ).item.gradient.saveState()

        return DataWindow.get_state(self, settings)
Beispiel #6
0
 def restore_from_state(self, settings, data_sources):
     """Restores the widget to the same state as when the settings were generated"""
     self.actionPlotSettings.setChecked(settings['actionPlotSettings'])
     self.actionPlotSettings.triggered.emit(self.actionPlotSettings.isChecked())
     self.settingsWidget.ui.x_label.setText(settings['x_label'][1:])
     self.settingsWidget.ui.y_label.setText(settings['y_label'][1:])
     self.settingsWidget.ui.x_label_auto.setChecked(settings['x_label_auto'])
     self.settingsWidget.ui.x_label_auto.toggled.emit(settings['x_label_auto'])
     self.settingsWidget.ui.y_label_auto.setChecked(settings['y_label_auto'])
     self.settingsWidget.ui.y_label_auto.toggled.emit(settings['y_label_auto'])
     self.settingsWidget.ui.colormap_min.setText(settings['colormap_min'])
     self.settingsWidget.ui.colormap_max.setText(settings['colormap_max'])
     self.settingsWidget.ui.colormap_max.editingFinished.emit()
     transpose = self.settingsWidget.ui.transpose
     transpose.setCurrentIndex(transpose.findText(settings['transpose']))
     flipy = self.settingsWidget.ui.flipy
     flipy.setCurrentIndex(flipy.findText(settings['flipy']))
     flipx = self.settingsWidget.ui.flipx
     flipx.setCurrentIndex(flipx.findText(settings['flipx']))
     self.plot.getView().getViewBox().setState(settings['viewbox'])
     self.actionX_axis.setChecked(settings['x_view'])
     self.actionX_axis.triggered.emit(settings['x_view'])
     self.actionY_axis.setChecked(settings['y_view'])
     self.actionY_axis.triggered.emit(settings['y_view'])
     self.actionHistogram.setChecked(settings['histogram_view'])
     self.actionHistogram.triggered.emit(settings['histogram_view'])
     self.actionCrosshair.setChecked(settings['crosshair'])
     self.actionCrosshair.triggered.emit(settings['crosshair'])
     self.plot.getHistogramWidget().item.gradient.restoreState(settings['gradient_mode'])
     
     return DataWindow.restore_from_state(self, settings, data_sources)
Beispiel #7
0
    def restore_from_state(self, settings, data_sources):
        """Restores the widget to the same state as when the settings were generated"""
        self.actionPlotSettings.setChecked(settings["actionPlotSettings"])
        self.actionPlotSettings.triggered.emit(self.actionPlotSettings.isChecked())
        self.settingsWidget.ui.x_label.setText(settings["x_label"][1:])
        self.settingsWidget.ui.y_label.setText(settings["y_label"][1:])
        self.settingsWidget.ui.x_label_auto.setChecked(settings["x_label_auto"])
        self.settingsWidget.ui.x_label_auto.toggled.emit(settings["x_label_auto"])
        self.settingsWidget.ui.y_label_auto.setChecked(settings["y_label_auto"])
        self.settingsWidget.ui.y_label_auto.toggled.emit(settings["y_label_auto"])
        self.settingsWidget.ui.colormap_min.setText(settings["colormap_min"])
        self.settingsWidget.ui.colormap_max.setText(settings["colormap_max"])
        self.settingsWidget.ui.colormap_max.editingFinished.emit()
        transpose = self.settingsWidget.ui.transpose
        transpose.setCurrentIndex(transpose.findText(settings["transpose"]))
        flipy = self.settingsWidget.ui.flipy
        flipy.setCurrentIndex(flipy.findText(settings["flipy"]))
        self.plot.getView().getViewBox().setState(settings["viewbox"])
        self.actionX_axis.setChecked(settings["x_view"])
        self.actionX_axis.triggered.emit(settings["x_view"])
        self.actionY_axis.setChecked(settings["y_view"])
        self.actionY_axis.triggered.emit(settings["y_view"])
        self.actionHistogram.setChecked(settings["histogram_view"])
        self.actionHistogram.triggered.emit(settings["histogram_view"])

        return DataWindow.restore_from_state(self, settings, data_sources)
Beispiel #8
0
 def restore_from_state(self, settings, data_sources):
     self.plot.getViewBox().setState(settings['viewbox'])
     self.actionX_axis.setChecked(settings['x_view'])
     self.actionX_axis.triggered.emit(settings['x_view'])
     self.actionY_axis.setChecked(settings['y_view'])
     self.actionY_axis.triggered.emit(settings['y_view'])
     self.actionLines.setChecked(settings['lines'])
     self.actionPoints.setChecked(settings['points'])
     self.actionLegend_Box.setChecked(settings['legend'])
     self.actionLegend_Box.triggered.emit(settings['legend'])
     return DataWindow.restore_from_state(self, settings, data_sources)
 def restore_from_state(self, settings, data_sources):
     self._settings_diag.restore_from_state(settings)
     self.plot.getViewBox().setState(settings['viewbox'])
     self.actionX_axis.setChecked(settings['x_view'])
     self.actionX_axis.triggered.emit(settings['x_view'])
     self.actionY_axis.setChecked(settings['y_view'])
     self.actionY_axis.triggered.emit(settings['y_view'])
     self.actionLines.setChecked(settings['lines'])
     self.actionPoints.setChecked(settings['points'])
     self.actionLegend_Box.setChecked(settings['legend'])
     self.actionLegend_Box.triggered.emit(settings['legend'])
     return DataWindow.restore_from_state(self, settings, data_sources)
 def get_state(self, _settings = None):
     """Returns settings that can be used to restore the widget to the current state"""
     settings = _settings or {}
     settings['window_type'] = 'PlotWindow'
     settings['viewbox'] = self.plot.getViewBox().getState()
     settings['x_view'] = self.actionX_axis.isChecked()
     settings['y_view'] = self.actionY_axis.isChecked()
     settings['lines'] = self.actionLines.isChecked()
     settings['points'] = self.actionPoints.isChecked()
     settings['legend'] = self.actionLegend_Box.isChecked()
     settings = self._settings_diag.get_state(settings)
     return DataWindow.get_state(self, settings)
Beispiel #11
0
    def get_state(self, _settings = None):
        """Returns settings that can be used to restore the widget to the current state"""
        settings = _settings or {}
        settings['window_type'] = 'PlotWindow'
        settings['viewbox'] = self.plot.getViewBox().getState()
        settings['x_view'] = self.actionX_axis.isChecked()
        settings['y_view'] = self.actionY_axis.isChecked()
        settings['lines'] = self.actionLines.isChecked()
        settings['points'] = self.actionPoints.isChecked()
        settings['legend'] = self.actionLegend_Box.isChecked()

        return DataWindow.get_state(self, settings)
Beispiel #12
0
 def get_state(self, _settings=None):
     """Returns settings that can be used to restore the widget to the current state"""
     settings = _settings or {}
     settings['window_type'] = 'PlotWindow'
     settings['viewbox'] = self.plot.getViewBox().getState()
     settings['x_view'] = self.actionX_axis.isChecked()
     settings['y_view'] = self.actionY_axis.isChecked()
     settings['lines'] = self.actionLines.isChecked()
     settings['points'] = self.actionPoints.isChecked()
     settings['legend'] = self.actionLegend_Box.isChecked()
     plot_item = self.plot.getPlotItem()
     settings['grid_x'] = plot_item.ctrl.xGridCheck.isChecked()
     settings['grid_y'] = plot_item.ctrl.yGridCheck.isChecked()
     settings['grid_alpha'] = plot_item.ctrl.gridAlphaSlider.value()
     settings = self._settings_diag.get_state(settings)
     return DataWindow.get_state(self, settings)
Beispiel #13
0
 def restore_from_state(self, settings, data_sources):
     self._settings_diag.restore_from_state(settings)
     self.plot.getViewBox().setState(settings['viewbox'])
     self.actionX_axis.setChecked(settings['x_view'])
     self.actionX_axis.triggered.emit(settings['x_view'])
     self.actionY_axis.setChecked(settings['y_view'])
     self.actionY_axis.triggered.emit(settings['y_view'])
     self.actionLines.setChecked(settings['lines'])
     self.actionPoints.setChecked(settings['points'])
     self.actionLegend_Box.setChecked(settings['legend'])
     self.actionLegend_Box.triggered.emit(settings['legend'])
     plot_item = self.plot.getPlotItem()
     plot_item.ctrl.xGridCheck.setChecked(settings['grid_x'])
     plot_item.ctrl.xGridCheck.toggled.emit(settings['grid_x'])
     plot_item.ctrl.yGridCheck.setChecked(settings['grid_y'])
     plot_item.ctrl.yGridCheck.toggled.emit(settings['grid_y'])
     plot_item.ctrl.gridAlphaSlider.setValue(settings['grid_alpha'])
     return DataWindow.restore_from_state(self, settings, data_sources)
Beispiel #14
0
    def get_state(self, _settings=None):
        """Returns settings that can be used to restore the widget to the current state"""
        settings = _settings or {}
        settings["window_type"] = "ImageWindow"
        settings["actionPlotSettings"] = self.actionPlotSettings.isChecked()
        # Disabled QLineEdits are confusing to QSettings. Store a dummy _
        settings["x_label"] = "_" + self.settingsWidget.ui.x_label.text()
        settings["y_label"] = "_" + self.settingsWidget.ui.y_label.text()
        settings["x_label_auto"] = self.settingsWidget.ui.x_label_auto.isChecked()
        settings["y_label_auto"] = self.settingsWidget.ui.y_label_auto.isChecked()
        settings["colormap_min"] = str(self.settingsWidget.ui.colormap_min.text())
        settings["colormap_max"] = str(self.settingsWidget.ui.colormap_max.text())
        settings["transpose"] = self.settingsWidget.ui.transpose.currentText()
        settings["flipy"] = self.settingsWidget.ui.flipy.currentText()
        settings["viewbox"] = self.plot.getView().getViewBox().getState()
        settings["x_view"] = self.actionX_axis.isChecked()
        settings["y_view"] = self.actionY_axis.isChecked()
        settings["histogram_view"] = self.actionHistogram.isChecked()

        return DataWindow.get_state(self, settings)
Beispiel #15
0
 def get_state(self, _settings = None):
     """Returns settings that can be used to restore the widget to the current state"""
     settings = _settings or {}
     settings['window_type'] = 'ImageWindow'
     settings['actionPlotSettings'] = self.actionPlotSettings.isChecked()
     # Disabled QLineEdits are confusing to QSettings. Store a dummy _
     settings['x_label'] = "_" + self.settingsWidget.ui.x_label.text()
     settings['y_label'] = "_" + self.settingsWidget.ui.y_label.text()
     settings['x_label_auto'] = self.settingsWidget.ui.x_label_auto.isChecked()
     settings['y_label_auto'] = self.settingsWidget.ui.y_label_auto.isChecked()
     settings['colormap_min'] = str(self.settingsWidget.ui.colormap_min.text())
     settings['colormap_max'] = str(self.settingsWidget.ui.colormap_max.text())
     settings['transpose'] = self.settingsWidget.ui.transpose.currentText()
     settings['flipx'] = self.settingsWidget.ui.flipx.currentText()
     settings['flipy'] = self.settingsWidget.ui.flipy.currentText()
     settings['viewbox'] = self.plot.getView().getViewBox().getState()
     settings['x_view'] = self.actionX_axis.isChecked()
     settings['y_view'] = self.actionY_axis.isChecked()
     settings['histogram_view'] = self.actionHistogram.isChecked()
     settings['crosshair'] = self.actionCrosshair.isChecked()
     settings['gradient_mode'] = self.plot.getHistogramWidget().item.gradient.saveState()
     
     return DataWindow.get_state(self, settings)
    def restore_from_state(self, settings, data_sources):
        """Restores the widget to the same state as when the settings were generated"""
        self.actionPlotSettings.setChecked(settings['actionPlotSettings'])
        self.actionPlotSettings.triggered.emit(
            self.actionPlotSettings.isChecked())
        self.settingsWidget.ui.x_label.setText(settings['x_label'][1:])
        self.settingsWidget.ui.y_label.setText(settings['y_label'][1:])
        self.settingsWidget.ui.x_label_auto.setChecked(
            settings['x_label_auto'])
        self.settingsWidget.ui.x_label_auto.toggled.emit(
            settings['x_label_auto'])
        self.settingsWidget.ui.y_label_auto.setChecked(
            settings['y_label_auto'])
        self.settingsWidget.ui.y_label_auto.toggled.emit(
            settings['y_label_auto'])
        self.settingsWidget.ui.colormap_min.setText(settings['colormap_min'])
        self.settingsWidget.ui.colormap_max.setText(settings['colormap_max'])
        self.settingsWidget.ui.colormap_max.editingFinished.emit()
        transpose = self.settingsWidget.ui.transpose
        transpose.setCurrentIndex(transpose.findText(settings['transpose']))
        flipy = self.settingsWidget.ui.flipy
        flipy.setCurrentIndex(flipy.findText(settings['flipy']))
        flipx = self.settingsWidget.ui.flipx
        flipx.setCurrentIndex(flipx.findText(settings['flipx']))
        self.plot.getView().getViewBox().setState(settings['viewbox'])
        self.actionX_axis.setChecked(settings['x_view'])
        self.actionX_axis.triggered.emit(settings['x_view'])
        self.actionY_axis.setChecked(settings['y_view'])
        self.actionY_axis.triggered.emit(settings['y_view'])
        self.actionHistogram.setChecked(settings['histogram_view'])
        self.actionHistogram.triggered.emit(settings['histogram_view'])
        self.actionCrosshair.setChecked(settings['crosshair'])
        self.actionCrosshair.triggered.emit(settings['crosshair'])
        self.plot.getHistogramWidget().item.gradient.restoreState(
            settings['gradient_mode'])

        return DataWindow.restore_from_state(self, settings, data_sources)
Beispiel #17
0
    def __init__(self, parent=None):
        # This also sets up the UI part
        DataWindow.__init__(self, parent)
        # This is imported here to prevent problems with sphinx
        from .image_view import ImageView
        self.plot = ImageView(self, view=pyqtgraph.PlotItem())
        self._finish_layout()
        self.infoLabel.setText('')
        self.acceptable_data_types = ['image', 'vector', 'triple', 'running_hist']
        self.exclusive_source = True
        self.meanmap = None
        self.last_x = None
        self.last_y = None
        self.mm_last = None
        self.vline = None
        self.hline = None

        self.settingsWidget.setVisible(self.actionPlotSettings.isChecked())
        self.settingsWidget.ui.colormap_min.editingFinished.connect(self.set_colormap_range)
        self.settingsWidget.ui.colormap_max.editingFinished.connect(self.set_colormap_range)
        self.settingsWidget.ui.colormap_min.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_max.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_full_range.clicked.connect(self.set_colormap_full_range)

        self.settingsWidget.ui.histogram_show.toggled.connect(self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(self.settingsWidget.ui.histogram_show.setChecked)
        self.settingsWidget.ui.histogram_show.toggled.connect(self.actionHistogram.setChecked)
        
        self.settingsWidget.ui.x_show.toggled.connect(self.toggle_axis)
        self.actionX_axis.triggered.connect(self.toggle_axis)        
        self.settingsWidget.ui.y_show.toggled.connect(self.toggle_axis)
        self.actionY_axis.triggered.connect(self.toggle_axis)        
        self.settingsWidget.ui.histogram_show.toggled.connect(self.toggle_axis)
        self.actionHistogram.triggered.connect(self.toggle_axis)

        self.settingsWidget.ui.modelCenterX.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.modelCenterY.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.modelDiameter.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.photonEnergy.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.detectorGain.setValidator(QtGui.QDoubleValidator())
        self.settingsWidget.ui.detectorDistance.setValidator(QtGui.QDoubleValidator())        
        self.settingsWidget.ui.detectorPixelSize.setValidator(QtGui.QDoubleValidator())
        self.modelParameters = {}

        success, spimage = utils.io.load_spimage()
        if not success:
            # no spimage available, we need to disable the model settings
            self.settingsWidget.ui.modelTab.setEnabled(False)
        else:
            self.spimage = spimage

        self.settingsWidget.ui.colormap_max.setValidator(QtGui.QDoubleValidator())

                
        self.plot.getHistogramWidget().region.sigRegionChangeFinished.connect(self.set_colormap_range)
        self.actionPlotSettings.triggered.connect(self.toggle_settings)

        # Make sure to disable native menus
        self.plot.getView().setMenuEnabled(False)
        self.plot.getHistogramWidget().vb.setMenuEnabled(False)
        self.x_axis_name = 'left'
        self.y_axis_name = 'bottom'
        self._set_logscale_lookuptable()

        self.running_hist_initialised = False

        self.actionReset_cache.triggered.connect(self.on_reset_cache)

        self.updateFonts()

        # By default do not show x and y axis on images
        self.plot.getView().getAxis('left').setVisible(False)
        self.actionY_axis.setChecked(False)
        self.plot.getView().getAxis('bottom').setVisible(False)
        self.actionX_axis.setChecked(False)

        self.plot.getView().scene().sigMouseMoved.connect(self._onMouseMoved)
        self.plot.getView().scene().sigMouseHover.connect(self._onMouseHover)
    def __init__(self, parent=None):
        # This also sets up the UI part
        DataWindow.__init__(self, parent)
        # This is imported here to prevent problems with sphinx
        from .image_view import ImageView
        self.plot = ImageView(self, view=pyqtgraph.PlotItem())
        self._finish_layout()
        self.infoLabel.setText('')
        self.acceptable_data_types = [
            'image', 'vector', 'triple', 'running_hist'
        ]
        self.exclusive_source = True
        self.meanmap = None
        self.last_x = None
        self.last_y = None
        self.mm_last = None
        self.vline = None
        self.hline = None

        self.settingsWidget.setVisible(self.actionPlotSettings.isChecked())
        self.settingsWidget.ui.colormap_min.editingFinished.connect(
            self.set_colormap_range)
        self.settingsWidget.ui.colormap_max.editingFinished.connect(
            self.set_colormap_range)
        self.settingsWidget.ui.colormap_min.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_max.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.colormap_full_range.clicked.connect(
            self.set_colormap_full_range)

        self.settingsWidget.ui.histogram_show.toggled.connect(
            self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(
            self.plot.getHistogramWidget().setVisible)
        self.actionHistogram.triggered.connect(
            self.settingsWidget.ui.histogram_show.setChecked)
        self.settingsWidget.ui.histogram_show.toggled.connect(
            self.actionHistogram.setChecked)

        self.settingsWidget.ui.x_show.toggled.connect(self.toggle_axis)
        self.actionX_axis.triggered.connect(self.toggle_axis)
        self.settingsWidget.ui.y_show.toggled.connect(self.toggle_axis)
        self.actionY_axis.triggered.connect(self.toggle_axis)
        self.settingsWidget.ui.histogram_show.toggled.connect(self.toggle_axis)
        self.actionHistogram.triggered.connect(self.toggle_axis)

        self.settingsWidget.ui.modelCenterX.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.modelCenterY.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.modelDiameter.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.photonEnergy.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.detectorGain.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.detectorDistance.setValidator(
            QtGui.QDoubleValidator())
        self.settingsWidget.ui.detectorPixelSize.setValidator(
            QtGui.QDoubleValidator())
        self.modelParameters = {}

        success, spimage = utils.io.load_spimage()
        if not success:
            # no spimage available, we need to disable the model settings
            self.settingsWidget.ui.modelTab.setEnabled(False)
        else:
            self.spimage = spimage

        self.settingsWidget.ui.colormap_max.setValidator(
            QtGui.QDoubleValidator())

        self.plot.getHistogramWidget().region.sigRegionChangeFinished.connect(
            self.set_colormap_range)
        self.actionPlotSettings.triggered.connect(self.toggle_settings)

        # Make sure to disable native menus
        self.plot.getView().setMenuEnabled(False)
        self.plot.getHistogramWidget().vb.setMenuEnabled(False)
        self.x_axis_name = 'left'
        self.y_axis_name = 'bottom'
        self._set_logscale_lookuptable()

        self.running_hist_initialised = False

        self.actionReset_cache.triggered.connect(self.on_reset_cache)