Files
Jungfraujoch/viewer/toolbar/JFJochViewerToolbarDisplay.cpp
Filip Leonarski 4dbbf0e365
Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m11s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m9s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m18s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m14s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 10m3s
Build Packages / Generate python client (push) Successful in 15s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m31s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m21s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m42s
Build Packages / build:rpm (rocky9) (push) Successful in 9m11s
Build Packages / Unit tests (push) Failing after 1h13m19s
v1.0.0-rc.97
This is an UNSTABLE release and not recommended for production use (please use rc.96 instead).

* jfjoch_broker: For DECTRIS detectors add dark data collection during initialization for bad pixel mask
* jfjoch_broker: Refactor of calibration logic for more clear code (likely to introduce problems)
* jfjoch_viewer: Add option to handle user pixel mask (experimental)
* jfjoch_viewer: More options for ROI
* jfjoch_viewer: Add window to display calibration

Reviewed-on: #2
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
2025-11-09 12:42:27 +01:00

76 lines
3.1 KiB
C++

// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "JFJochViewerToolbarDisplay.h"
#include <QLabel>
#include "../../common/ColorScale.h"
JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
: QToolBar(parent) {
addWidget(new QLabel("<b>Foreground </b>&nbsp;&nbsp;"));
foreground_slider = new SliderPlusBox(1, 65000, 1.0, 1, this,
SliderPlusBox::ScaleType::Logarithmic);
foreground_slider->setValue(10);
addWidget(foreground_slider);
auto_foreground_button = new QPushButton("Auto");
auto_foreground_button->setCheckable(true);
auto_foreground_button->setChecked(auto_foreground);
addWidget(auto_foreground_button);
addWidget(new QLabel("&nbsp;&nbsp;<b>Color map</b>&nbsp;&nbsp;"));
// Initialize QComboBox with the options
color_map_select = new QComboBox(this);
color_map_select->addItem("Viridis", static_cast<int>(ColorScaleEnum::Viridis));
color_map_select->addItem("Heat", static_cast<int>(ColorScaleEnum::Heat));
color_map_select->addItem("Indigo", static_cast<int>(ColorScaleEnum::Indigo));
color_map_select->addItem("B/W", static_cast<int>(ColorScaleEnum::BW));
color_map_select->setCurrentIndex(static_cast<int>(ColorScaleEnum::Indigo));
addWidget(color_map_select);
addWidget(new QLabel("&nbsp;&nbsp;<b>Background </b>&nbsp;&nbsp;"));
background_slider = new SliderPlusBox(-30000, 30000, 1.0, 1, this,
SliderPlusBox::ScaleType::Linear);
background_slider->setValue(0);
addWidget(background_slider);
auto *stretch = new QWidget(this);
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
addWidget(stretch);
connect(foreground_slider, &SliderPlusBox::valueChanged, this, &JFJochViewerToolbarDisplay::foregroundSet);
connect(background_slider, &SliderPlusBox::valueChanged, this, &JFJochViewerToolbarDisplay::backgroundSet);
connect(color_map_select, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &JFJochViewerToolbarDisplay::colorComboBoxSet);
connect(auto_foreground_button, &QPushButton::clicked, this, &JFJochViewerToolbarDisplay::autoForegroundButtonPressed);
}
void JFJochViewerToolbarDisplay::foregroundSet(double val) {
if (auto_foreground) {
auto_foreground = false;
auto_foreground_button->setChecked(false);
emit setAutoForeground(false);
}
emit setForeground(static_cast<float>(val));
}
void JFJochViewerToolbarDisplay::backgroundSet(double val) {
emit setBackground(static_cast<float>(val));
}
void JFJochViewerToolbarDisplay::updateForeground(float val) {
QSignalBlocker blocker(foreground_slider);
foreground_slider->setValue(val);
}
void JFJochViewerToolbarDisplay::colorComboBoxSet(int val) {
emit colorMapChanged(val);
}
void JFJochViewerToolbarDisplay::autoForegroundButtonPressed() {
auto_foreground = !auto_foreground;
auto_foreground_button->setChecked(auto_foreground);
emit setAutoForeground(auto_foreground);
}