Build Packages / Unit tests (push) Successful in 1h31m59s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m5s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m24s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 10m27s
Build Packages / build:rpm (rocky8) (push) Successful in 9m20s
Build Packages / build:rpm (rocky9) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m54s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m38s
Build Packages / DIALS test (push) Successful in 12m13s
Build Packages / XDS test (durin plugin) (push) Successful in 7m8s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m8s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m50s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Skipped
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use. * jfjoch_broker: Add EXPERIMENTAL pixelrefine mode for image processing * jfjoch_broker: Allow to load user mask from 8-bit and 16-bit TIFF files * jfjoch_broker: Add ROI calculation in non-FPGA workflow * jfjoch_broker: Fixes to TCP image pusher * jfjoch_broker: Remove NUMA bindings * jfjoch_broker: Improvements to indexing * jfjoch_broker: For PSI EIGER, trimming energies are taken from the detector configuration (now compulsory) instead of hardcoded values * jfjoch_writer: Save ROI definitions and the per-pixel ROI bitmap in the master file; azimuthal ROIs support phi (angular) sectors * jfjoch_viewer: Major redesign with dockable panels and saved layouts, plus on-canvas creation/move/resize of box, circle and azimuthal ROIs * jfjoch_viewer: Run jfjoch_process reprocessing jobs from inside the GUI and overlay per-run results Reviewed-on: #63
105 lines
4.5 KiB
C++
105 lines
4.5 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"
|
|
#include "../widgets/ToolbarIcons.h"
|
|
|
|
constexpr double MAX_SLIDER_NO_IMAGE = 65000;
|
|
|
|
JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
|
|
: QToolBar(parent) {
|
|
setWindowTitle("Display"); // shown in the toolbar/dock context menu
|
|
addWidget(new QLabel(" Foreground ", this));
|
|
|
|
foreground_slider = new SliderPlusBox(1, MAX_SLIDER_NO_IMAGE, 1.0, 1, this,
|
|
SliderPlusBox::ScaleType::Logarithmic);
|
|
foreground_slider->setValue(10);
|
|
foreground_slider->setToolTip("White point of the colour map (image contrast)");
|
|
foreground_slider->setStyleSheet(
|
|
"QSlider::groove:horizontal { height:6px; background:#F3D9D4; border-radius:3px; }"
|
|
"QSlider::sub-page:horizontal { background:#FA7268; border-radius:3px; }"
|
|
"QSlider::handle:horizontal { background:#1F3A5F; width:14px; margin:-5px 0; border-radius:7px; }"
|
|
"QSlider::handle:horizontal:hover { background:#16314F; }");
|
|
addWidget(foreground_slider);
|
|
|
|
auto makeToggle = [this](const QString &text, const QString &tip) {
|
|
auto *b = new QToolButton(this);
|
|
b->setText(text);
|
|
b->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
|
b->setCheckable(true);
|
|
b->setToolTip(tip);
|
|
b->setCursor(Qt::PointingHandCursor);
|
|
b->setStyleSheet(ToolbarIcons::buttonStyle());
|
|
return b;
|
|
};
|
|
auto_foreground_button = makeToggle("Auto", "Auto-contrast to the current image");
|
|
addWidget(auto_foreground_button);
|
|
hdr_mode_button = makeToggle("HDR", "High dynamic range: show the full intensity range unclipped");
|
|
addWidget(hdr_mode_button);
|
|
|
|
addWidget(new QLabel(" Colour map ", this));
|
|
|
|
// Initialize QComboBox with the options
|
|
color_map_select = new QComboBox(this);
|
|
color_map_select->addItem("Indigo", static_cast<int>(ColorScaleEnum::Indigo));
|
|
color_map_select->addItem("Viridis", static_cast<int>(ColorScaleEnum::Viridis));
|
|
color_map_select->addItem("Magma", static_cast<int>(ColorScaleEnum::Magma));
|
|
color_map_select->addItem("Inferno", static_cast<int>(ColorScaleEnum::Inferno));
|
|
color_map_select->addItem("Heat", static_cast<int>(ColorScaleEnum::Heat));
|
|
color_map_select->addItem("Black on white", static_cast<int>(ColorScaleEnum::BW));
|
|
color_map_select->addItem("White on black", static_cast<int>(ColorScaleEnum::WB));
|
|
color_map_select->addItem("Green", static_cast<int>(ColorScaleEnum::Green));
|
|
|
|
color_map_select->setCurrentIndex(static_cast<int>(ColorScaleEnum::Indigo));
|
|
addWidget(color_map_select);
|
|
|
|
connect(foreground_slider, &SliderPlusBox::valueChanged, this, &JFJochViewerToolbarDisplay::foregroundSet);
|
|
connect(color_map_select, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
|
this, &JFJochViewerToolbarDisplay::colorComboBoxSet);
|
|
connect(auto_foreground_button, &QToolButton::clicked, this, &JFJochViewerToolbarDisplay::autoForegroundButtonPressed);
|
|
connect(hdr_mode_button, &QToolButton::clicked, this, &JFJochViewerToolbarDisplay::HDRModeButtonPressed);
|
|
auto *stretch = new QWidget(this);
|
|
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
addWidget(stretch);
|
|
}
|
|
|
|
void JFJochViewerToolbarDisplay::foregroundSet(double val) {
|
|
emit setForeground(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() {
|
|
emit setAutoForeground(auto_foreground_button->isChecked());
|
|
}
|
|
|
|
void JFJochViewerToolbarDisplay::updateAutoForeground(bool val) {
|
|
QSignalBlocker blocker(auto_foreground_button);
|
|
auto_foreground_button->setChecked(val);
|
|
}
|
|
|
|
void JFJochViewerToolbarDisplay::HDRModeButtonPressed() {
|
|
emit setHDRMode(hdr_mode_button->isChecked());
|
|
}
|
|
|
|
void JFJochViewerToolbarDisplay::imageLoaded(std::shared_ptr<const JFJochReaderImage> image) {
|
|
if (image) {
|
|
auto valid = image->ValidMinMax();
|
|
if (valid.has_value() && valid->second > 1)
|
|
foreground_slider->setMax(valid->second);
|
|
else
|
|
foreground_slider->setMax(MAX_SLIDER_NO_IMAGE);
|
|
} else {
|
|
foreground_slider->setMax(MAX_SLIDER_NO_IMAGE);
|
|
}
|
|
}
|