Пример #1
0
    def _initGui(self):
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-geometry.ui"), self)
        icon = icons.getQIcon("pyfai:gui/icons/task-fit-geometry")
        self.setWindowIcon(icon)

        self.initNextStep()
        self.widgetShow.connect(self.__widgetShow)

        self.__plot = self.__createPlot()
        self.__plot.sigMouseMove.connect(self.__mouseMoved)
        self.__plot.sigMouseLeave.connect(self.__mouseLeft)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        userAngleUnit = CalibrationContext.instance().getAngleUnit()
        userLengthUnit = CalibrationContext.instance().getLengthUnit()
        userWavelengthUnit = CalibrationContext.instance().getWavelengthUnit()

        layout = qt.QGridLayout(self._settings)
        self.__wavelength = FitParamView(self, "Wavelength:",
                                         units.Unit.METER_WL,
                                         userWavelengthUnit)
        self.addParameterToLayout(layout, self.__wavelength)

        layout = qt.QGridLayout(self._geometry)
        self.__distance = FitParamView(self, "Distance:", units.Unit.METER,
                                       userLengthUnit)
        self.__poni1 = FitParamView(self, "PONI1:", units.Unit.METER,
                                    userLengthUnit)
        self.__poni2 = FitParamView(self, "PONI2:", units.Unit.METER,
                                    userLengthUnit)

        self.__rotation1 = FitParamView(self, "Rotation 1:", units.Unit.RADIAN,
                                        userAngleUnit)
        self.__rotation2 = FitParamView(self, "Rotation 2:", units.Unit.RADIAN,
                                        userAngleUnit)
        self.__rotation3 = FitParamView(self, "Rotation 3:", units.Unit.RADIAN,
                                        userAngleUnit)
        self.addParameterToLayout(layout, self.__distance)
        self.addParameterToLayout(layout, self.__poni1)
        self.addParameterToLayout(layout, self.__poni2)
        self.addParameterToLayout(layout, self.__rotation1)
        self.addParameterToLayout(layout, self.__rotation2)
        self.addParameterToLayout(layout, self.__rotation3)

        self._fitButton.clicked.connect(self.__fitGeometryLater)
        self._fitButton.setDisabledWhenWaiting(True)
        self._resetButton.clicked.connect(self.__resetGeometryLater)
        self.__calibration = None
        self.__peaksInvalidated = False
        self.__fitting = False
        self.__wavelengthInvalidated = False

        self.__synchronizeRawView = SynchronizeRawView()
        self.__synchronizeRawView.registerTask(self)
        self.__synchronizeRawView.registerPlot(self.__plot)
Пример #2
0
    def __init__(self, parent=None):
        """

        :param parent: parent QWidget
        :param labels: list of labels for each dimension of the array
        """
        qt.QWidget.__init__(self, parent)
        self.mainLayout = qt.QVBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)

        self.browserContainer = qt.QWidget(self)
        self.browserLayout = qt.QGridLayout(self.browserContainer)
        self.browserLayout.setContentsMargins(0, 0, 0, 0)
        self.browserLayout.setSpacing(0)

        self._dimensionLabelsText = []
        """List of text labels sorted in the increasing order of the dimension
        they apply to."""
        self._browserLabels = []
        """List of QLabel widgets."""
        self._browserWidgets = []
        """List of HorizontalSliderWithBrowser widgets."""

        self.axesSelector = AxesSelector(self)

        self.view = TableView(self)

        self.mainLayout.addWidget(self.browserContainer)
        self.mainLayout.addWidget(self.axesSelector)
        self.mainLayout.addWidget(self.view)

        self.model = ArrayTableModel(self)
        self.view.setModel(self.model)
Пример #3
0
    def _initColorBar(self):
        """Create the ColorBarWidget and add it to the PlotWidget"""

        # Add a colorbar on the right side
        colorBar = ColorBarWidget(parent=self, plot=self)

        # Make ColorBarWidget background white by changing its palette
        colorBar.setAutoFillBackground(True)
        palette = colorBar.palette()
        palette.setColor(qt.QPalette.Background, qt.Qt.white)
        palette.setColor(qt.QPalette.Window, qt.Qt.white)
        colorBar.setPalette(palette)

        # Add the ColorBarWidget by changing PlotWidget's central widget
        gridLayout = qt.QGridLayout()
        gridLayout.setSpacing(0)
        gridLayout.setContentsMargins(0, 0, 0, 0)
        plot = self.getWidgetHandle()  # Get the widget rendering the plot
        gridLayout.addWidget(plot, 0, 0)
        gridLayout.addWidget(colorBar, 0, 1)
        gridLayout.setRowStretch(0, 1)
        gridLayout.setColumnStretch(0, 1)
        centralWidget = qt.QWidget()
        centralWidget.setLayout(gridLayout)
        self.setCentralWidget(centralWidget)
Пример #4
0
    def createIconPanel(self, parent):
        panel = qt.QWidget(parent)
        layout = qt.QGridLayout()
        # layout.setSizeConstraint(qt.QLayout.SetMinAndMaxSize)
        panel.setLayout(layout)

        self.tools = []

        # Sort together animated and non animated icons
        fix_icons = self.getAllAvailableIcons()
        animated_icons = self.getAllAvailableAnimatedIcons()
        icons = []
        icons.extend([(i, "_") for i in fix_icons])
        icons.extend([(i, "anim") for i in animated_icons])
        icons = sorted(icons)

        for i, icon_info in enumerate(icons):
            icon_name, icon_kind = icon_info
            col, line = i / 10, i % 10
            if icon_kind == "anim":
                tool = AnimatedToolButton(panel)
                icon = silx.gui.icons.getAnimatedIcon(icon_name)
                tool.setToolTip("Animated icon '%s'" % icon_name)
            else:
                tool = qt.QToolButton(panel)
                icon = silx.gui.icons.getQIcon(icon_name)
                tool.setToolTip("Icon '%s'" % icon_name)
            tool.setIcon(icon)
            tool.setIconSize(qt.QSize(32, 32))
            layout.addWidget(tool, col, line)
            self.tools.append(tool)

        return panel
Пример #5
0
    def __init__(self, *args, **kwargs):
        super(DoublePointDock, self).__init__(*args, **kwargs)

        widget = Qt.QWidget()
        layout = Qt.QGridLayout(widget)
        layout.setContentsMargins(0, 0, 0, 0)

        self.__mouseVisible = True
        self.__selectedVisible = True

        self.__mousePoint = mousePoint = PointWidget()
        self.__mouseLabel = mouseLabel = Qt.QLabel('Mouse')
        mousePoint.setFrameStyle(Qt.QFrame.Box)
        self.__selectedPoint = selectedPoint = PointWidget()
        self.__selectedLabel = selectedLabel = Qt.QLabel('Selected')
        selectedPoint.setFrameStyle(Qt.QFrame.Box)

        layout.addWidget(mouseLabel, 0, 0, Qt.Qt.AlignLeft)
        layout.addWidget(mousePoint, 0, 1, Qt.Qt.AlignLeft)
        layout.addWidget(selectedLabel, 1, 0, Qt.Qt.AlignLeft)
        layout.addWidget(selectedPoint, 1, 1, Qt.Qt.AlignLeft)

        layout.setColumnStretch(2, 1)

        self.setWidget(widget)
Пример #6
0
    def __init__(self, parent=None):
        """

        :param parent: Parent QWidget
        """
        super(ArrayCurvePlot, self).__init__(parent)

        self.__signals = None
        self.__signals_names = None
        self.__signal_errors = None
        self.__axis = None
        self.__axis_name = None
        self.__x_axis_errors = None
        self.__values = None

        self._plot = Plot1D(self)

        self.selectorDock = qt.QDockWidget("Data selector", self._plot)
        # not closable
        self.selectorDock.setFeatures(qt.QDockWidget.DockWidgetMovable
                                      | qt.QDockWidget.DockWidgetFloatable)
        self._selector = NumpyAxesSelector(self.selectorDock)
        self._selector.setNamedAxesSelectorVisibility(False)
        self.__selector_is_connected = False
        self.selectorDock.setWidget(self._selector)
        self._plot.addTabbedDockWidget(self.selectorDock)

        self._plot.sigActiveCurveChanged.connect(
            self._setYLabelFromActiveLegend)

        layout = qt.QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._plot, 0, 0)

        self.setLayout(layout)
Пример #7
0
    def createIconPanel(self, parent):
        panel = qt.QWidget(parent)
        layout = qt.QGridLayout()
        # layout.setSizeConstraint(qt.QLayout.SetMinAndMaxSize)
        panel.setLayout(layout)

        self.tools = []

        import silx.resources

        icons = silx.resources.list_dir("gui/icons")
        # filter out sub-directories
        icons = filter(lambda x: not silx.resources.is_dir("gui/icons/" + x),
                       icons)
        # remove extension
        icons = [i.split(".")[0] for i in icons]
        # remove duplicated names
        icons = set(icons)
        # sort by names
        icons = sorted(icons)

        for i, icon_name in enumerate(icons):
            col, line = i / 10, i % 10
            icon = silx.gui.icons.getQIcon(icon_name)
            tool = qt.QToolButton(panel)
            tool.setIcon(icon)
            tool.setIconSize(qt.QSize(32, 32))
            tool.setToolTip(icon_name)
            layout.addWidget(tool, col, line)
            self.tools.append(tool)

        return panel
    def __init__(self, parent=None):
        qt.QWidget.__init__(self, parent)

        self.resize(234, 53)

        grid_layout = qt.QGridLayout(self)
        grid_layout.setContentsMargins(11, 11, 11, 11)
        grid_layout.setSpacing(6)
        layout = qt.QHBoxLayout(None)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(6)

        self.EstimateButton = qt.QPushButton(self)
        self.EstimateButton.setText("Estimate")
        layout.addWidget(self.EstimateButton)
        spacer = qt.QSpacerItem(20, 20, qt.QSizePolicy.Expanding,
                                qt.QSizePolicy.Minimum)
        layout.addItem(spacer)

        self.StartFitButton = qt.QPushButton(self)
        self.StartFitButton.setText("Start Fit")
        layout.addWidget(self.StartFitButton)
        spacer_2 = qt.QSpacerItem(20, 20, qt.QSizePolicy.Expanding,
                                  qt.QSizePolicy.Minimum)
        layout.addItem(spacer_2)

        self.DismissButton = qt.QPushButton(self)
        self.DismissButton.setText("Dismiss")
        layout.addWidget(self.DismissButton)

        grid_layout.addLayout(layout, 0, 0)
    def _createPencilSettings(self, parent=None):
        pencilSetting = qt.QWidget(parent)

        self.pencilSpinBox = qt.QSpinBox(parent=pencilSetting)
        self.pencilSpinBox.setRange(1, 1024)
        pencilToolTip = """Set pencil drawing tool size in pixels of the image
            on which to make the mask."""
        self.pencilSpinBox.setToolTip(pencilToolTip)

        self.pencilSlider = qt.QSlider(qt.Qt.Horizontal, parent=pencilSetting)
        self.pencilSlider.setRange(1, 50)
        self.pencilSlider.setToolTip(pencilToolTip)

        pencilLabel = qt.QLabel('Pencil size:', parent=pencilSetting)

        layout = qt.QGridLayout()
        layout.addWidget(pencilLabel, 0, 0)
        layout.addWidget(self.pencilSpinBox, 0, 1)
        layout.addWidget(self.pencilSlider, 1, 1)
        pencilSetting.setLayout(layout)

        self.pencilSpinBox.valueChanged.connect(self._pencilWidthChanged)
        self.pencilSlider.valueChanged.connect(self._pencilWidthChanged)

        return pencilSetting
Пример #10
0
    def __init__(self, parent=None):
        super(IntroPage, self).__init__(parent)

        self.__nextId = XsocsWizard.OpenId

        self.setTitle('Welcome to X-SOCS.')
        self.setSubTitle('X-ray Strain Orientation Calculation Software')

        style = Qt.QApplication.style()
        icon = XsocsIcons.getQPixmap('xsocs')
        self.setPixmap(Qt.QWizard.WatermarkPixmap, icon)
        icon = XsocsIcons.getQPixmap('logo')
        self.setPixmap(Qt.QWizard.LogoPixmap, icon)

        layout = Qt.QGridLayout(self)
        icon = style.standardIcon(Qt.QStyle.SP_DialogOpenButton)
        openBn = Qt.QToolButton()
        openBn.setIcon(icon)
        layout.addWidget(openBn, 1, 1)
        layout.addWidget(Qt.QLabel('Open an existing project.'), 1, 2)

        icon = style.standardIcon(Qt.QStyle.SP_FileDialogNewFolder)
        newBn = Qt.QToolButton()
        newBn.setIcon(icon)
        layout.addWidget(newBn, 2, 1)
        layout.addWidget(Qt.QLabel('Create new project.'), 2, 2)

        layout.setRowStretch(0, 1)
        layout.setRowStretch(3, 1)
        layout.setColumnStretch(3, 1)

        openBn.clicked.connect(partial(self.__buttonClicked,
                                       nextId=XsocsWizard.OpenId))
        newBn.clicked.connect(partial(self.__buttonClicked,
                                      nextId=XsocsWizard.CreateId))
Пример #11
0
    def __createInfoLayout(self, parent):
        layout = qt.QGridLayout()

        header = qt.QLabel(parent=parent)
        header.setText("Time: ")
        label = qt.QLabel(parent=parent)
        label.setText("")
        layout.addWidget(header, 0, 0)
        layout.addWidget(label, 0, 1)
        self.__timeLabel = label

        header = qt.QLabel(parent=parent)
        header.setText("Nb polygons: ")
        label = qt.QLabel(parent=parent)
        label.setText("")
        layout.addWidget(header, 2, 0)
        layout.addWidget(label, 2, 1)
        self.__polygonsLabel = label

        header = qt.QLabel(parent=parent)
        header.setText("Nb points: ")
        label = qt.QLabel(parent=parent)
        label.setText("")
        layout.addWidget(header, 1, 0)
        layout.addWidget(label, 1, 1)
        self.__pointsLabel = label

        return layout
Пример #12
0
    def __init__(self, parent=None):
        super(SelectDataPage, self).__init__(parent)

        self.setTitle('X-Socs')
        self.setSubTitle('New project : select data to load/import.')

        icon = XsocsIcons.getQPixmap('xsocs')
        self.setPixmap(Qt.QWizard.WatermarkPixmap, icon)
        icon = XsocsIcons.getQPixmap('logo')
        self.setPixmap(Qt.QWizard.LogoPixmap, icon)

        self.setTitle('Select input data.')

        self.__nextId = -1

        layout = Qt.QGridLayout(self)
        icon = XsocsIcons.getQIcon('logo')
        xsocsBn = Qt.QToolButton()
        xsocsBn.setIcon(icon)
        layout.addWidget(xsocsBn, 1, 1)
        layout.addWidget(Qt.QLabel('Load X-Socs Data (HDF5).'), 1, 2)

        icon = XsocsIcons.getQIcon('spec')
        specBn = Qt.QToolButton()
        specBn.setIcon(icon)
        layout.addWidget(specBn, 2, 1)
        layout.addWidget(Qt.QLabel('Import SPEC data.'), 2, 2)

        layout.setRowStretch(0, 1)
        layout.setRowStretch(3, 1)
        layout.setColumnStretch(3, 1)

        xsocsBn.clicked.connect(partial(self.__buttonClicked, source='XSOCS'))
        specBn.clicked.connect(partial(self.__buttonClicked, source='SPEC'))
Пример #13
0
    def __init__(self, label=None, **kwargs):
        """

        :param label: text displayed above the slider.
        :param kwargs:
        """
        super(RoiAxisWidget, self).__init__(**kwargs)

        layout = Qt.QGridLayout(self)
        qLabel = FixedSizeLabel(nChar=1)
        qLabel.setFrameStyle(Qt.QFrame.NoFrame | Qt.QFrame.Plain)
        qLabel.setText(label)
        slider = self.__slider = RangeSlider()
        leftEdit = self.__leftEdit = StyledLineEdit(nChar=7)
        rightEdit = self.__rightEdit = StyledLineEdit(nChar=7)
        leftEdit.setReadOnly(True)
        rightEdit.setReadOnly(True)

        layout.addWidget(qLabel, 0, 0)
        layout.addWidget(slider, 0, 1, 1, 2)
        layout.addWidget(leftEdit, 1, 1)
        layout.addWidget(rightEdit, 1, 2)

        layout.setColumnStretch(3, 1)

        slider.sigSliderMoved.connect(self.__sliderMoved)
        slider.sigSliderMoved.connect(self.sigSliderMoved)
Пример #14
0
    def __init__(self, parent=None):
        super(MyPlotWindow, self).__init__(parent)

        # Create a PlotWidget
        self._plot = PlotWidget(parent=self)

        # Create a colorbar linked with the PlotWidget
        colorBar = ColorBarWidget(parent=self, plot=self._plot)

        # Make ColorBarWidget background white by changing its palette
        colorBar.setAutoFillBackground(True)
        palette = colorBar.palette()
        palette.setColor(qt.QPalette.Background, qt.Qt.white)
        palette.setColor(qt.QPalette.Window, qt.Qt.white)
        colorBar.setPalette(palette)

        # Combine the ColorBarWidget and the PlotWidget as
        # this QMainWindow's central widget
        gridLayout = qt.QGridLayout()
        gridLayout.setSpacing(0)
        gridLayout.setContentsMargins(0, 0, 0, 0)
        gridLayout.addWidget(self._plot, 0, 0)
        gridLayout.addWidget(colorBar, 0, 1)
        gridLayout.setRowStretch(0, 1)
        gridLayout.setColumnStretch(0, 1)
        centralWidget = qt.QWidget(self)
        centralWidget.setLayout(gridLayout)
        self.setCentralWidget(centralWidget)

        # Add ready to use toolbar with zoom and pan interaction mode buttons
        interactionToolBar = tools.InteractiveModeToolBar(parent=self,
                                                          plot=self._plot)
        self.addToolBar(interactionToolBar)
        # Add toolbar actions to activate keyboard shortcuts
        self.addActions(interactionToolBar.actions())

        # Add a new toolbar
        toolBar = qt.QToolBar("Plot Tools", self)
        self.addToolBar(toolBar)

        # Add actions from silx.gui.plot.action to the toolbar
        resetZoomAction = actions.control.ResetZoomAction(parent=self,
                                                          plot=self._plot)
        toolBar.addAction(resetZoomAction)

        # Add tool buttons from silx.gui.plot.PlotToolButtons
        aspectRatioButton = PlotToolButtons.AspectToolButton(parent=self,
                                                             plot=self._plot)
        toolBar.addWidget(aspectRatioButton)

        # Add ready to use toolbar with copy, save and print buttons
        outputToolBar = tools.OutputToolBar(parent=self, plot=self._plot)
        self.addToolBar(outputToolBar)
        # Add toolbar actions to activate keyboard shortcuts
        self.addActions(outputToolBar.actions())

        # Add limits tool bar from silx.gui.plot.PlotTools
        limitsToolBar = tools.LimitsToolBar(parent=self, plot=self._plot)
        self.addToolBar(qt.Qt.BottomToolBarArea, limitsToolBar)
Пример #15
0
 def __init__(self, parent=None):
     qt.QDialog.__init__(self)
     self.widget = AIWidget()
     self.layout = qt.QGridLayout(self)
     self.layout.addWidget(self.widget)
     self.widget.okButton.clicked.disconnect()
     self.widget.do_2D.setEnabled(False)
     self.widget.cancelButton.clicked.disconnect()
     self.widget.okButton.clicked.connect(self.accept)
     self.widget.cancelButton.clicked.connect(self.reject)
    def __init__(self):
        qt.QMainWindow.__init__(self)
        self.setWindowTitle("Plot with synchronized axes")
        widget = qt.QWidget(self)
        self.setCentralWidget(widget)

        layout = qt.QGridLayout()
        widget.setLayout(layout)

        backend = "gl"
        plots = []

        data = numpy.arange(100 * 100)
        data = (data % 100) / 5.0
        data = numpy.sin(data)
        data.shape = 100, 100

        colormaps = ["gray", "red", "green", "blue"]
        for i in range(2 * 2):
            plot = Plot2D(parent=widget, backend=backend)
            plot.setInteractiveMode('pan')
            plot.setDefaultColormap(Colormap(colormaps[i]))
            noisyData = silx.test.utils.add_gaussian_noise(data, mean=i / 10.0)
            plot.addImage(noisyData)
            plots.append(plot)

        xAxis = [p.getXAxis() for p in plots]
        yAxis = [p.getYAxis() for p in plots]

        self.constraint1 = SyncAxes(xAxis,
                                    syncLimits=False,
                                    syncScale=True,
                                    syncDirection=True,
                                    syncCenter=True,
                                    syncZoom=True)
        self.constraint2 = SyncAxes(yAxis,
                                    syncLimits=False,
                                    syncScale=True,
                                    syncDirection=True,
                                    syncCenter=True,
                                    syncZoom=True)

        for i, plot in enumerate(plots):
            if i % 2 == 0:
                plot.setFixedWidth(400)
            else:
                plot.setFixedWidth(500)
            if i // 2 == 0:
                plot.setFixedHeight(400)
            else:
                plot.setFixedHeight(500)
            layout.addWidget(plot, i // 2, i % 2)
    def __init__(self, parent=None):
        qt.QWidget.__init__(self, parent)

        self.setWindowTitle("FitConfigGUI")

        layout = qt.QGridLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(6)

        self.FunLabel = qt.QLabel(self)
        self.FunLabel.setText("Function")
        layout.addWidget(self.FunLabel, 0, 0)

        self.FunComBox = qt.QComboBox(self)
        self.FunComBox.addItem("Add Function(s)")
        self.FunComBox.setItemData(self.FunComBox.findText("Add Function(s)"),
                                   "Load fit theories from a file",
                                   qt.Qt.ToolTipRole)
        layout.addWidget(self.FunComBox, 0, 1)

        self.BkgLabel = qt.QLabel(self)
        self.BkgLabel.setText("Background")
        layout.addWidget(self.BkgLabel, 1, 0)

        self.BkgComBox = qt.QComboBox(self)
        self.BkgComBox.addItem("Add Background(s)")
        self.BkgComBox.setItemData(
            self.BkgComBox.findText("Add Background(s)"),
            "Load background theories from a file", qt.Qt.ToolTipRole)
        layout.addWidget(self.BkgComBox, 1, 1)

        self.FunConfigureButton = qt.QPushButton(self)
        self.FunConfigureButton.setText("Configure")
        self.FunConfigureButton.setToolTip(
            "Open a configuration dialog for the selected function")
        layout.addWidget(self.FunConfigureButton, 0, 2)

        self.BgConfigureButton = qt.QPushButton(self)
        self.BgConfigureButton.setText("Configure")
        self.BgConfigureButton.setToolTip(
            "Open a configuration dialog for the selected background")
        layout.addWidget(self.BgConfigureButton, 1, 2)

        self.WeightCheckBox = qt.QCheckBox(self)
        self.WeightCheckBox.setText("Weighted fit")
        self.WeightCheckBox.setToolTip(
            "Enable usage of weights in the least-square problem.\n Use" +
            " the uncertainties (sigma) if provided, else use sqrt(y).")

        layout.addWidget(self.WeightCheckBox, 0, 3, 2, 1)

        layout.setColumnStretch(4, 1)
    def __init__(self):
        qt.QMainWindow.__init__(self)
        self.setWindowTitle("Plot with synchronized axes")
        widget = qt.QWidget(self)
        self.setCentralWidget(widget)

        layout = qt.QGridLayout()
        widget.setLayout(layout)

        backend = "mpl"

        data = numpy.arange(100 * 100)
        data = (data % 100) / 5.0
        data = numpy.sin(data)
        data = silx.test.utils.add_gaussian_noise(data, mean=0.01)
        data.shape = 100, 100

        data1d = numpy.mean(data, axis=0)

        self.plot2d = plot.Plot2D(parent=widget, backend=backend)
        self.plot2d.setGraphTitle("A pixel can't be too big")
        self.plot2d.setInteractiveMode('pan')
        self.plot2d.addImage(data)
        self.plot2d.getXAxis().setRangeConstraints(minRange=10)
        self.plot2d.getYAxis().setRangeConstraints(minRange=10)

        self.plot2d2 = plot.Plot2D(parent=widget, backend=backend)
        self.plot2d2.setGraphTitle("The image can't be too small")
        self.plot2d2.setInteractiveMode('pan')
        self.plot2d2.addImage(data)
        self.plot2d2.getXAxis().setRangeConstraints(maxRange=200)
        self.plot2d2.getYAxis().setRangeConstraints(maxRange=200)

        self.plot1d = plot.Plot1D(parent=widget, backend=backend)
        self.plot1d.setGraphTitle("The curve is clamped into the view")
        self.plot1d.addCurve(x=numpy.arange(100), y=data1d, legend="mean")
        self.plot1d.getXAxis().setLimitsConstraints(minPos=0, maxPos=100)
        self.plot1d.getYAxis().setLimitsConstraints(minPos=data1d.min(),
                                                    maxPos=data1d.max())

        self.plot1d2 = plot.Plot1D(parent=widget, backend=backend)
        self.plot1d2.setGraphTitle("Only clamp y-axis")
        self.plot1d2.setInteractiveMode('pan')
        self.plot1d2.addCurve(x=numpy.arange(100), y=data1d, legend="mean")
        self.plot1d2.getYAxis().setLimitsConstraints(minPos=data1d.min(),
                                                     maxPos=data1d.max())

        layout.addWidget(self.plot2d, 0, 0)
        layout.addWidget(self.plot1d, 0, 1)
        layout.addWidget(self.plot2d2, 1, 0)
        layout.addWidget(self.plot1d2, 1, 1)
Пример #19
0
    def __init__(self):
        super(GeometryTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-geometry.ui"), self)
        self.initNextStep()
        self.widgetShow.connect(self.__widgetShow)

        self.__plot = self.__createPlot()

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        layout = qt.QGridLayout(self._settings)
        self.__wavelength = FitParamView(self, "Wavelength:", u"Å")
        self.addParameterToLayout(layout, self.__wavelength)

        layout = qt.QGridLayout(self._geometry)
        self.__distance = FitParamView(self, "Distance:", "m")
        self.__poni1 = FitParamView(self, "PONI1:", u"m")
        self.__poni2 = FitParamView(self, "PONI2:", u"m")
        self.__rotation1 = FitParamView(self, "Rotation 1:", u"rad")
        self.__rotation2 = FitParamView(self, "Rotation 2:", u"rad")
        self.__rotation3 = FitParamView(self, "Rotation 3:", u"rad")
        self.addParameterToLayout(layout, self.__distance)
        self.addParameterToLayout(layout, self.__poni1)
        self.addParameterToLayout(layout, self.__poni2)
        self.addParameterToLayout(layout, self.__rotation1)
        self.addParameterToLayout(layout, self.__rotation2)
        self.addParameterToLayout(layout, self.__rotation3)

        self._fitButton.clicked.connect(self.__fitGeometry)
        self._fitButton.setDisabledWhenWaiting(True)
        self._resetButton.clicked.connect(self.__resetGeometry)
        self.__calibration = None
        self.__peaksInvalidated = False
        self.__fitting = False
Пример #20
0
 def _initTransparencyWidget(self):
     """ Init the mask transparency widget """
     transparencyWidget = qt.QWidget(parent=self)
     grid = qt.QGridLayout()
     grid.setContentsMargins(0, 0, 0, 0)
     self.transparencySlider = qt.QSlider(qt.Qt.Horizontal, parent=transparencyWidget)
     self.transparencySlider.setRange(3, 10)
     self.transparencySlider.setValue(8)
     self.transparencySlider.setToolTip(
             'Set the transparency of the mask display')
     self.transparencySlider.valueChanged.connect(self._updateColors)
     grid.addWidget(qt.QLabel('Display:', parent=transparencyWidget), 0, 0)
     grid.addWidget(self.transparencySlider, 0, 1, 1, 3)
     grid.addWidget(qt.QLabel('<small><b>Transparent</b></small>', parent=transparencyWidget), 1, 1)
     grid.addWidget(qt.QLabel('<small><b>Opaque</b></small>', parent=transparencyWidget), 1, 3)
     transparencyWidget.setLayout(grid)
     return transparencyWidget
Пример #21
0
    def makeCombineDataGroup(self):
        self.combineType = qt.QComboBox()
        self.combineType.addItems(csp.combineNames)
        self.combineType.currentIndexChanged.connect(self.combineTypeChanged)
        self.combineNLabel = qt.QLabel("N=")
        self.combineN = qt.QSpinBox()
        self.combineN.setMinimum(1)
        self.combineStopCB = qt.QCheckBox(
            u"stop propagation of\ncontributing data at:")
        self.combineStopCB.stateChanged.connect(self.combineStopCBChanged)
        self.combineStop = qt.QComboBox()
        self.combineStop.addItems(csi.nodes.keys())
        self.combineMoveToGroupCB = qt.QCheckBox(
            u"move selected data to a new group")
        self.combineDo = qt.QPushButton("Combine")
        self.combineDo.clicked.connect(self.createCombined)

        #        layout = qt.QVBoxLayout()
        #        layout.addWidget(self.combineType)
        #        layout.addWidget(self.combineStopCB)
        #        layout.addWidget(self.combineStop)
        #        layout.addWidget(self.combineDo)
        #        layout.addStretch()
        layout = qt.QGridLayout()
        layout.setContentsMargins(2, 0, 2, 2)
        layout.addWidget(self.combineType, 0, 0)
        layoutN = qt.QHBoxLayout()
        layoutN.addStretch()
        layoutN.addWidget(self.combineNLabel)
        layoutN.addWidget(self.combineN)
        layout.addLayout(layoutN, 0, 1)
        layout.addWidget(self.combineStopCB, 1, 0)
        layout.addWidget(self.combineStop, 1, 1)
        layout.addWidget(self.combineMoveToGroupCB, 2, 0, 1, 2)
        layout.addWidget(self.combineDo, 3, 0, 1, 2)

        group = qt.QGroupBox('combine selected data')
        group.setLayout(layout)
        # group.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed)
        return group
Пример #22
0
    def __init__(self, parent=None):
        """

        :param parent: Parent QWidget
        """
        super(XYVScatterPlot, self).__init__(parent)

        self.__y_axis = None
        """1D array"""
        self.__y_axis_name = None
        self.__values = None
        """List of 1D arrays (for multiple scatters with identical
        x, y coordinates)"""

        self.__x_axis = None
        self.__x_axis_name = None
        self.__x_axis_errors = None
        self.__y_axis = None
        self.__y_axis_name = None
        self.__y_axis_errors = None

        self._plot = ScatterView(self)
        self._plot.setColormap(
            Colormap(name="viridis",
                     vmin=None,
                     vmax=None,
                     normalization=Colormap.LINEAR))

        self._slider = HorizontalSliderWithBrowser(parent=self)
        self._slider.setMinimum(0)
        self._slider.setValue(0)
        self._slider.valueChanged[int].connect(self._sliderIdxChanged)
        self._slider.setToolTip("Select auxiliary signals")

        layout = qt.QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._plot, 0, 0)
        layout.addWidget(self._slider, 1, 0)

        self.setLayout(layout)
Пример #23
0
    def __init__(self, parent=None) -> None:
        qt.QWidget.__init__(self, parent)
        self.setLayout(qt.QGridLayout())
        self._toggleButton = qt.QPushButton(parent=self)
        self.layout().addWidget(self._toggleButton, 0, 2, 1, 1)
        self._toggleButton.setSizePolicy(qt.QSizePolicy.Fixed,
                                         qt.QSizePolicy.Fixed)

        self._urlsTable = UrlList(parent=self)
        self.layout().addWidget(self._urlsTable, 1, 1, 1, 2)

        # set up
        self._setButtonIcon(show=True)

        # Signal / slot connection
        self._toggleButton.clicked.connect(self.toggleUrlSelectionTable)
        self._urlsTable.sigCurrentUrlChanged.connect(self._propagateSignal)

        # expose API
        self.setUrls = self._urlsTable.setUrls
        self.setUrl = self._urlsTable.setUrl
        self.currentItem = self._urlsTable.currentItem
Пример #24
0
    def __init__(self, parent=None):
        """

        :param parent: Parent QWidget
        """
        super(ArrayCurvePlot, self).__init__(parent)

        self.__signal = None
        self.__signal_name = None
        self.__signal_errors = None
        self.__axis = None
        self.__axis_name = None
        self.__axis_errors = None
        self.__values = None

        self.__first_curve_added = False

        self._plot = Plot1D(self)
        self._plot.setDefaultColormap(   # for scatters
                {"name": "viridis",
                 "vmin": 0., "vmax": 1.,   # ignored (autoscale) but mandatory
                 "normalization": "linear",
                 "autoscale": True})

        self.selectorDock = qt.QDockWidget("Data selector", self._plot)
        # not closable
        self.selectorDock.setFeatures(qt.QDockWidget.DockWidgetMovable
                                      | qt.QDockWidget.DockWidgetFloatable)
        self._selector = NumpyAxesSelector(self.selectorDock)
        self._selector.setNamedAxesSelectorVisibility(False)
        self.__selector_is_connected = False
        self.selectorDock.setWidget(self._selector)
        self._plot.addTabbedDockWidget(self.selectorDock)

        layout = qt.QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._plot, 0, 0)

        self.setLayout(layout)
Пример #25
0
    def __init__(self,
                 parent=None,
                 name="PeriodicTable",
                 elements=None,
                 selectable=False):
        self.selectable = selectable
        qt.QWidget.__init__(self, parent)
        self.setWindowTitle(name)
        self.gridLayout = qt.QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.addItem(qt.QSpacerItem(0, 5), 7, 0)

        for idx in range(10):
            self.gridLayout.setRowStretch(idx, 3)
        # row 8 (above lanthanoids  is empty)
        self.gridLayout.setRowStretch(7, 2)

        # Element information displayed when cursor enters a cell
        self.eltLabel = qt.QLabel(self)
        f = self.eltLabel.font()
        f.setBold(1)
        self.eltLabel.setFont(f)
        self.eltLabel.setAlignment(qt.Qt.AlignHCenter)
        self.gridLayout.addWidget(self.eltLabel, 1, 1, 3, 10)

        self._eltCurrent = None
        """Current :class:`_ElementButton` (last clicked)"""

        self._eltButtons = OrderedDict()
        """Dictionary of all :class:`_ElementButton`. Keys are the symbols
        ("H", "He", "Li"...)"""

        if elements is None:
            elements = _defaultTableItems
        # fill cells with elements
        for elmt in elements:
            self.__addElement(elmt)
Пример #26
0
    def __init__(self, parent=None, plot=None):
        if plot is None or not isinstance(plot, PlotWidget):
            raise AttributeError("parameter plot is required")
        qt.QDialog.__init__(self, parent)

        self.setWindowTitle("Plot items selector")

        kind_selector_label = qt.QLabel("Filter item kinds:", self)
        item_selector_label = qt.QLabel("Select items:", self)

        self.kind_selector = KindsSelector(self)
        self.kind_selector.setToolTip(
            "select one or more item kinds to show them in the item list")

        self.item_selector = PlotItemsSelector(self, plot)
        self.item_selector.setToolTip("select items")

        self.item_selector.setKindsFilter(self.kind_selector.selectedKinds)
        self.kind_selector.sigSelectedKindsChanged.connect(
            self.item_selector.setKindsFilter)

        okb = qt.QPushButton("OK", self)
        okb.clicked.connect(self.accept)

        cancelb = qt.QPushButton("Cancel", self)
        cancelb.clicked.connect(self.reject)

        layout = qt.QGridLayout(self)
        layout.addWidget(kind_selector_label, 0, 0)
        layout.addWidget(item_selector_label, 0, 1)
        layout.addWidget(self.kind_selector, 1, 0)
        layout.addWidget(self.item_selector, 1, 1)
        layout.addWidget(okb, 2, 0)
        layout.addWidget(cancelb, 2, 1)

        self.setLayout(layout)
Пример #27
0
    def __init__(self, **kwargs):
        super(ConversionParamsWidget, self).__init__(**kwargs)
        layout = Qt.QGridLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)

        # ===========
        # image binning
        # ===========
        row = 0
        layout.addWidget(Qt.QLabel('Img binning :'), row, 0)
        h_layout = Qt.QHBoxLayout()
        layout.addLayout(h_layout,
                         row,
                         1,
                         alignment=Qt.Qt.AlignLeft | Qt.Qt.AlignTop)
        imgbin_h_edit = StyledLineEdit(nChar=5)
        imgbin_h_edit.setValidator(Qt.QIntValidator(imgbin_h_edit))
        imgbin_h_edit.setAlignment(Qt.Qt.AlignRight)
        imgbin_h_edit.setText(str(_DEFAULT_IMG_BIN[0]))
        h_layout.addWidget(imgbin_h_edit, alignment=Qt.Qt.AlignLeft)
        h_layout.addWidget(Qt.QLabel(' x '))
        imgbin_v_edit = StyledLineEdit(nChar=5)
        imgbin_v_edit.setValidator(Qt.QIntValidator(imgbin_v_edit))
        imgbin_v_edit.setAlignment(Qt.Qt.AlignRight)
        imgbin_v_edit.setText(str(_DEFAULT_IMG_BIN[1]))
        h_layout.addWidget(imgbin_v_edit, alignment=Qt.Qt.AlignLeft)
        h_layout.addWidget(Qt.QLabel('px'))
        h_layout.addStretch(1)

        # ===========
        # qspace size
        # ===========

        row += 1
        layout.addWidget(Qt.QLabel('Q space size :'), row, 0)
        h_layout = Qt.QHBoxLayout()
        layout.addLayout(h_layout,
                         row,
                         1,
                         alignment=Qt.Qt.AlignLeft | Qt.Qt.AlignTop)
        qsize_x_edit = StyledLineEdit(nChar=5)
        qsize_x_edit.setValidator(Qt.QDoubleValidator(qsize_x_edit))
        qsize_x_edit.setAlignment(Qt.Qt.AlignRight)
        h_layout.addWidget(qsize_x_edit)
        h_layout.addWidget(Qt.QLabel(' x '))
        qsize_y_edit = StyledLineEdit(nChar=5)
        qsize_y_edit.setValidator(Qt.QDoubleValidator(qsize_y_edit))
        qsize_y_edit.setAlignment(Qt.Qt.AlignRight)
        h_layout.addWidget(qsize_y_edit)
        h_layout.addWidget(Qt.QLabel(' x '))
        qsize_z_edit = StyledLineEdit(nChar=5)
        qsize_z_edit.setValidator(Qt.QDoubleValidator(qsize_z_edit))
        qsize_z_edit.setAlignment(Qt.Qt.AlignRight)
        h_layout.addWidget(qsize_z_edit)
        h_layout.addWidget(Qt.QLabel('bins'))
        h_layout.addStretch(1)

        self.__imgbin_h_edit = imgbin_h_edit
        self.__imgbin_v_edit = imgbin_v_edit
        self.__qsize_x_edit = qsize_x_edit
        self.__qsize_y_edit = qsize_y_edit
        self.__qsize_z_edit = qsize_z_edit

        # ===========
        # size constraints
        # ===========
        self.setSizePolicy(
            Qt.QSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed))
Пример #28
0
    def _initGui(self):
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-geometry.ui"), self)
        icon = icons.getQIcon("pyfai:gui/icons/task-fit-geometry")
        self.setWindowIcon(icon)

        self.__calibrationState = CalibrationState(self)
        self.__calibration = None
        self.__peaksInvalidated = False
        self.__fitting = False
        self.__wavelengthInvalidated = False

        self.initNextStep()
        self.widgetShow.connect(self.__widgetShow)

        self.__plot = self.__createPlot()
        self.__plot.setObjectName("plot-fit")
        self.__plot.sigMouseMove.connect(self.__mouseMoved)
        self.__plot.sigMouseLeave.connect(self.__mouseLeft)
        self.__plot.setCalibrationState(self.__calibrationState)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)
        self.__defaultConstraints = GeometryConstraintsModel()

        userAngleUnit = CalibrationContext.instance().getAngleUnit()
        userLengthUnit = CalibrationContext.instance().getLengthUnit()
        userWavelengthUnit = CalibrationContext.instance().getWavelengthUnit()

        layout = qt.QGridLayout(self._settings)
        self.__wavelength = FitParamView(self, "Wavelength",
                                         units.Unit.METER_WL,
                                         userWavelengthUnit)
        self.addParameterToLayout(layout, self.__wavelength)

        layout = qt.QGridLayout(self._geometry)
        self.__distance = FitParamView(self, "Distance", units.Unit.METER,
                                       userLengthUnit)
        self.__poni1 = FitParamView(self, "PONI1", units.Unit.METER,
                                    userLengthUnit)
        self.__poni2 = FitParamView(self, "PONI2", units.Unit.METER,
                                    userLengthUnit)

        self.__rotation1 = FitParamView(self, "Rotation 1", units.Unit.RADIAN,
                                        userAngleUnit)
        self.__rotation2 = FitParamView(self, "Rotation 2", units.Unit.RADIAN,
                                        userAngleUnit)
        self.__rotation3 = FitParamView(self, "Rotation 3", units.Unit.RADIAN,
                                        userAngleUnit)

        self.__wavelength.sigValueAccepted.connect(self.__geometryCustomed)
        self.__distance.sigValueAccepted.connect(self.__geometryCustomed)
        self.__poni1.sigValueAccepted.connect(self.__geometryCustomed)
        self.__poni2.sigValueAccepted.connect(self.__geometryCustomed)
        self.__rotation1.sigValueAccepted.connect(self.__geometryCustomed)
        self.__rotation2.sigValueAccepted.connect(self.__geometryCustomed)
        self.__rotation3.sigValueAccepted.connect(self.__geometryCustomed)

        self.__distance.setDefaultConstraintsModel(
            self.__defaultConstraints.distance())
        self.__wavelength.setDefaultConstraintsModel(
            self.__defaultConstraints.wavelength())
        self.__poni1.setDefaultConstraintsModel(
            self.__defaultConstraints.poni1())
        self.__poni2.setDefaultConstraintsModel(
            self.__defaultConstraints.poni2())
        self.__rotation1.setDefaultConstraintsModel(
            self.__defaultConstraints.rotation1())
        self.__rotation2.setDefaultConstraintsModel(
            self.__defaultConstraints.rotation2())
        self.__rotation3.setDefaultConstraintsModel(
            self.__defaultConstraints.rotation3())

        self.addParameterToLayout(layout, self.__distance)
        self.addParameterToLayout(layout, self.__poni1)
        self.addParameterToLayout(layout, self.__poni2)
        self.addParameterToLayout(layout, self.__rotation1)
        self.addParameterToLayout(layout, self.__rotation2)
        self.addParameterToLayout(layout, self.__rotation3)

        self._fitButton.clicked.connect(self.__fitGeometryLater)
        self._fitButton.setDisabledWhenWaiting(True)
        self._resetButton.clicked.connect(self.__resetGeometryLater)

        self.__synchronizeRawView = SynchronizeRawView()
        self.__synchronizeRawView.registerTask(self)
        self.__synchronizeRawView.registerPlot(self.__plot)

        constraintLayout = qt.QHBoxLayout()
        defaultConstraintsButton = qt.QPushButton("Default contraints", self)
        defaultConstraintsButton.setToolTip(
            "Remove all the custom constraints.")
        saxsConstraintsButton = qt.QPushButton("SAXS contraints", self)
        saxsConstraintsButton.setToolTip("Force all the rotations to zero.")
        constraintLayout.addWidget(defaultConstraintsButton)
        constraintLayout.addWidget(saxsConstraintsButton)
        layout.addLayout(constraintLayout, layout.rowCount(), 0, 1, -1)
        defaultConstraintsButton.clicked.connect(self.__setDefaultConstraints)
        saxsConstraintsButton.clicked.connect(self.__setSaxsConstraints)

        self._geometryHistoryCombo.activated.connect(
            self.__geometryPickedFromHistory)
        self._geometryHistoryCombo.setAngleUnit(userAngleUnit)

        self.__calibrationState.changed.connect(self.__updateResidual)
        self.__updateResidual()
    def _initThresholdGroupBox(self):
        """Init thresholding widgets"""

        self.belowThresholdAction = qt.QAction(
            icons.getQIcon('plot-roi-below'), 'Mask below threshold', None)
        self.belowThresholdAction.setToolTip(
            'Mask image where values are below given threshold')
        self.belowThresholdAction.setCheckable(True)
        self.belowThresholdAction.setChecked(True)

        self.betweenThresholdAction = qt.QAction(
            icons.getQIcon('plot-roi-between'), 'Mask within range', None)
        self.betweenThresholdAction.setToolTip(
            'Mask image where values are within given range')
        self.betweenThresholdAction.setCheckable(True)

        self.aboveThresholdAction = qt.QAction(
            icons.getQIcon('plot-roi-above'), 'Mask above threshold', None)
        self.aboveThresholdAction.setToolTip(
            'Mask image where values are above given threshold')
        self.aboveThresholdAction.setCheckable(True)

        self.thresholdActionGroup = qt.QActionGroup(self)
        self.thresholdActionGroup.setExclusive(True)
        self.thresholdActionGroup.addAction(self.belowThresholdAction)
        self.thresholdActionGroup.addAction(self.betweenThresholdAction)
        self.thresholdActionGroup.addAction(self.aboveThresholdAction)
        self.thresholdActionGroup.triggered.connect(
            self._thresholdActionGroupTriggered)

        self.loadColormapRangeAction = qt.QAction(
            icons.getQIcon('view-refresh'), 'Set min-max from colormap', None)
        self.loadColormapRangeAction.setToolTip(
            'Set min and max values from current colormap range')
        self.loadColormapRangeAction.setCheckable(False)
        self.loadColormapRangeAction.triggered.connect(
            self._loadRangeFromColormapTriggered)

        widgets = []
        for action in self.thresholdActionGroup.actions():
            btn = qt.QToolButton()
            btn.setDefaultAction(action)
            widgets.append(btn)

        spacer = qt.QWidget()
        spacer.setSizePolicy(qt.QSizePolicy.Expanding,
                             qt.QSizePolicy.Preferred)
        widgets.append(spacer)

        loadColormapRangeBtn = qt.QToolButton()
        loadColormapRangeBtn.setDefaultAction(self.loadColormapRangeAction)
        widgets.append(loadColormapRangeBtn)

        toolBar = self._hboxWidget(*widgets, stretch=False)

        config = qt.QGridLayout()
        config.setContentsMargins(0, 0, 0, 0)

        self.minLineLabel = qt.QLabel("Min:", self)
        self.minLineEdit = FloatEdit(self, value=0)
        config.addWidget(self.minLineLabel, 0, 0)
        config.addWidget(self.minLineEdit, 0, 1)

        self.maxLineLabel = qt.QLabel("Max:", self)
        self.maxLineEdit = FloatEdit(self, value=0)
        config.addWidget(self.maxLineLabel, 1, 0)
        config.addWidget(self.maxLineEdit, 1, 1)

        self.applyMaskBtn = qt.QPushButton('Apply mask')
        self.applyMaskBtn.clicked.connect(self._maskBtnClicked)

        layout = qt.QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addLayout(config)
        layout.addWidget(self.applyMaskBtn)

        self.thresholdGroup = qt.QGroupBox('Threshold')
        self.thresholdGroup.setLayout(layout)

        # Init widget state
        self._thresholdActionGroupTriggered(self.belowThresholdAction)
        return self.thresholdGroup
Пример #30
0
    def __init__(self, parent=None, resetzoom=True, backend=None,
                 autoScale=False, logScale=False, grid=False,
                 colormap=True, aspectRatio=True, yinverted=True,
                 copy=True, save=True, print_=True, control=False,
                 position=None, mask=True):
        qt.QMainWindow.__init__(self, parent)
        if parent is not None:
            # behave as a widget
            self.setWindowFlags(qt.Qt.Widget)
        else:
            self.setWindowTitle('StackView')

        self._stack = None
        """Loaded stack, as a 3D array, a 3D dataset or a list of 2D arrays."""
        self.__transposed_view = None
        """View on :attr:`_stack` with the axes sorted, to have
        the orthogonal dimension first"""
        self._perspective = 0
        """Orthogonal dimension (depth) in :attr:`_stack`"""

        self.__imageLegend = '__StackView__image' + str(id(self))
        self.__autoscaleCmap = False
        """Flag to disable/enable colormap auto-scaling
        based on the min/max values of the entire 3D volume"""
        self.__dimensionsLabels = ["Dimension 0", "Dimension 1",
                                   "Dimension 2"]
        """These labels are displayed on the X and Y axes.
        :meth:`setLabels` updates this attribute."""

        self._first_stack_dimension = 0
        """Used for dimension labels and combobox"""

        self._titleCallback = self._defaultTitleCallback
        """Function returning the plot title based on the frame index.
        It can be set to a custom function using :meth:`setTitleCallback`"""

        self.calibrations3D = (calibration.NoCalibration(),
                               calibration.NoCalibration(),
                               calibration.NoCalibration())

        central_widget = qt.QWidget(self)

        self._plot = PlotWindow(parent=central_widget, backend=backend,
                                resetzoom=resetzoom, autoScale=autoScale,
                                logScale=logScale, grid=grid,
                                curveStyle=False, colormap=colormap,
                                aspectRatio=aspectRatio, yInverted=yinverted,
                                copy=copy, save=save, print_=print_,
                                control=control, position=position,
                                roi=False, mask=mask)
        self._plot.getIntensityHistogramAction().setVisible(True)
        self.sigInteractiveModeChanged = self._plot.sigInteractiveModeChanged
        self.sigActiveImageChanged = self._plot.sigActiveImageChanged
        self.sigPlotSignal = self._plot.sigPlotSignal

        if silx.config.DEFAULT_PLOT_IMAGE_Y_AXIS_ORIENTATION == 'downward':
            self._plot.getYAxis().setInverted(True)

        self._addColorBarAction()

        self._plot.profile = Profile3DToolBar(parent=self._plot,
                                              stackview=self)
        self._plot.addToolBar(self._plot.profile)
        self._plot.getXAxis().setLabel('Columns')
        self._plot.getYAxis().setLabel('Rows')
        self._plot.sigPlotSignal.connect(self._plotCallback)

        self.__planeSelection = PlanesWidget(self._plot)
        self.__planeSelection.sigPlaneSelectionChanged.connect(self.setPerspective)

        self._browser_label = qt.QLabel("Image index (Dim0):")

        self._browser = HorizontalSliderWithBrowser(central_widget)
        self._browser.setRange(0, 0)
        self._browser.valueChanged[int].connect(self.__updateFrameNumber)
        self._browser.setEnabled(False)

        layout = qt.QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._plot, 0, 0, 1, 3)
        layout.addWidget(self.__planeSelection, 1, 0)
        layout.addWidget(self._browser_label, 1, 1)
        layout.addWidget(self._browser, 1, 2)

        central_widget.setLayout(layout)
        self.setCentralWidget(central_widget)

        # clear profile lines when the perspective changes (plane browsed changed)
        self.__planeSelection.sigPlaneSelectionChanged.connect(
            self._plot.profile.getProfilePlot().clear)
        self.__planeSelection.sigPlaneSelectionChanged.connect(
            self._plot.profile.clearProfile)