jfjoch_viewer: Handle autocontrast better
Some checks failed
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 11m39s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 11m41s
Build Packages / Generate python client (push) Successful in 34s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 12m23s
Build Packages / Build documentation (push) Successful in 44s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m3s
Build Packages / build:rpm (rocky8) (push) Successful in 13m11s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m10s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m39s
Build Packages / build:rpm (rocky9) (push) Successful in 14m19s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 6m57s
Build Packages / Unit tests (push) Has been cancelled

This commit is contained in:
2025-11-14 17:24:47 +01:00
parent a4b6231ed8
commit 7608b93a0f
6 changed files with 26 additions and 12 deletions

View File

@@ -153,6 +153,9 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
connect(toolBarDisplay, &JFJochViewerToolbarDisplay::setForeground, viewer,
&JFJochDiffractionImage::changeForeground);
connect(viewer, &JFJochDiffractionImage::autoForegroundChanged,
toolBarDisplay, &JFJochViewerToolbarDisplay::updateAutoForeground);
connect(toolBarDisplay, &JFJochViewerToolbarDisplay::setAutoForeground, viewer,
&JFJochDiffractionImage::setAutoForeground);

View File

@@ -15,7 +15,7 @@ JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
addWidget(foreground_slider);
auto_foreground_button = new QPushButton("Auto");
auto_foreground_button->setCheckable(true);
auto_foreground_button->setChecked(auto_foreground);
auto_foreground_button->setChecked(false);
addWidget(auto_foreground_button);
addWidget(new QLabel("&nbsp;&nbsp;<b>Color map</b>&nbsp;&nbsp;"));
@@ -40,11 +40,6 @@ JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
}
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));
}
@@ -59,7 +54,10 @@ void JFJochViewerToolbarDisplay::colorComboBoxSet(int val) {
void JFJochViewerToolbarDisplay::autoForegroundButtonPressed() {
auto_foreground = !auto_foreground;
auto_foreground_button->setChecked(auto_foreground);
emit setAutoForeground(auto_foreground);
}
emit setAutoForeground(auto_foreground_button->isChecked());
}
void JFJochViewerToolbarDisplay::updateAutoForeground(bool val) {
QSignalBlocker blocker(auto_foreground_button);
auto_foreground_button->setChecked(val);
}

View File

@@ -28,6 +28,7 @@ signals:
public slots:
void updateForeground(float val);
void updateAutoForeground(bool val);
private slots:
void foregroundSet(double val);

View File

@@ -304,11 +304,12 @@ void JFJochDiffractionImage::loadImage(std::shared_ptr<const JFJochReaderImage>
void JFJochDiffractionImage::setAutoForeground(bool input) {
auto_fg = input;
if (image && auto_fg) {
// If auto_foreground is not set, then view stays with the current settings till these are explicitely changed
// If auto_foreground is not set, then view stays with the current settings till these are explicitly changed
foreground = image->GetAutoContrastValue();
emit foregroundChanged(foreground);
Redraw();
}
emit autoForegroundChanged(auto_fg);
}
void JFJochDiffractionImage::setResolutionRing(QVector<float> v) {
@@ -376,3 +377,9 @@ void JFJochDiffractionImage::highlightIceRings(bool input) {
highlight_ice_rings = input;
updateOverlay();
}
void JFJochDiffractionImage::changeForeground(float val) {
auto_fg = false;
emit autoForegroundChanged(false);
JFJochImage::changeForeground(val);
}

View File

@@ -43,6 +43,10 @@ private:
float ice_ring_width_Q_recipA = 0.01;
void mouseHover(QMouseEvent* event) override;
signals:
void autoForegroundChanged(bool input);
public slots:
void loadImage(std::shared_ptr<const JFJochReaderImage> image);
void setAutoForeground(bool input);
@@ -59,5 +63,6 @@ public slots:
void showSaturation(bool input);
void highlightIceRings(bool input);
void changeForeground(float val) override;
};

View File

@@ -73,7 +73,7 @@ private slots:
public slots:
void setFeatureColor(QColor input);
void setColorMap(int color_map);
void changeForeground(float val);
virtual void changeForeground(float val);
void changeBackground(float val);
void SetROIBox(QRect box);