v1.0.0-rc.135 (#44)
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m55s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 10m28s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m47s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m7s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m31s
Build Packages / build:rpm (rocky8) (push) Successful in 12m59s
Build Packages / build:rpm (rocky9) (push) Successful in 14m5s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 15m30s
Build Packages / Generate python client (push) Successful in 1m18s
Build Packages / Build documentation (push) Successful in 1m3s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (ubuntu2404) (push) Successful in 10m8s
Build Packages / XDS test (durin plugin) (push) Successful in 9m16s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m59s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m12s
Build Packages / DIALS test (push) Successful in 11m44s
Build Packages / Unit tests (push) Successful in 1h23m8s

This is an UNSTABLE release. The release has significant modifications and bug fixes, if things go wrong, it is better to revert to 1.0.0-rc.132.

* Multiple small bug fixes scattered across the whole code base. (detected with GPT-5.4)
* jfjoch_viewer: Improve image render performance

Reviewed-on: #44
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #44.
This commit is contained in:
2026-04-16 11:59:59 +02:00
committed by leonarski_f
parent 4a852b4d6b
commit bb9f5c715f
203 changed files with 610 additions and 449 deletions
+28 -15
View File
@@ -5,6 +5,7 @@
#include "../../common/DiffractionGeometry.h"
#include <QGraphicsPixmapItem>
#include <QGraphicsSimpleTextItem>
#include <QGraphicsScene>
#include <QWheelEvent>
#include <QScrollBar>
@@ -104,11 +105,12 @@ void JFJochDiffractionImage::DrawSpots() {
QPen pen(pen_color, 3);
pen.setCosmetic(true);
auto rect = scene()->addRect(s.x - spot_size + 0.5,
auto *rect = scene()->addRect(s.x - spot_size + 0.5,
s.y - spot_size + 0.5,
2 * spot_size,
2 * spot_size,
pen);
addOverlayItem(rect);
}
}
@@ -132,11 +134,12 @@ void JFJochDiffractionImage::DrawPredictions() {
if (!visibleRect.contains(QPointF{s.predicted_x, s.predicted_y}))
continue;
auto rect = scene()->addEllipse(s.predicted_x - spot_size + 0.5f,
auto *ellipse = scene()->addEllipse(s.predicted_x - spot_size + 0.5f,
s.predicted_y - spot_size + 0.5f,
2.0f * spot_size,
2.0f * spot_size,
pen);
addOverlayItem(ellipse);
// When zoomed in enough, draw "h k l" above the box
if (scale_factor >= 10.0) {
@@ -147,11 +150,13 @@ void JFJochDiffractionImage::DrawPredictions() {
const qreal text_x = s.predicted_x - 5.5f;
const qreal text_y = s.predicted_y - 10.0f;
// Add or update text in the scene
QGraphicsTextItem *textItem = scene()->addText(label, font);
textItem->setDefaultTextColor(pen_color);
textItem->setPos(text_x, text_y); // Position the text over the pixel
// textItem->setScale(1.0); // Scale down to 10% of the original size
// Use QGraphicsSimpleTextItem for much better performance
auto *textItem = new QGraphicsSimpleTextItem(label);
textItem->setFont(font);
textItem->setBrush(pen_color);
textItem->setPos(text_x, text_y);
scene()->addItem(textItem);
addOverlayItem(textItem);
}
}
}
@@ -244,7 +249,7 @@ void JFJochDiffractionImage::DrawResolutionRings() {
auto y_max = std::max({y1, y2, y3, y4});
QRectF boundingRect(x_min, y_min, x_max - x_min, y_max - y_min);
scene()->addEllipse(boundingRect, pen);
addOverlayItem(scene()->addEllipse(boundingRect, pen));
auto [x5,y5] = geom.ResPhiToPxl(d, phi_offset + 0);
auto [x6,y6] = geom.ResPhiToPxl(d, phi_offset + M_PI_2);
@@ -272,10 +277,13 @@ void JFJochDiffractionImage::DrawResolutionRings() {
const qreal f = std::clamp(scale_factor, 0.5, 50.0);
font.setPointSizeF(16.0 / sqrt(f)); // base 12pt around scale_factor ~10
QGraphicsTextItem *textItem = scene()->addText(
QString("%1 Å").arg(QString::number(d, 'f', 2)), font);
textItem->setDefaultTextColor(ring_color);
auto *textItem = new QGraphicsSimpleTextItem(
QString("%1 Å").arg(QString::number(d, 'f', 2)));
textItem->setFont(font);
textItem->setBrush(ring_color);
textItem->setPos(point.value());
scene()->addItem(textItem);
addOverlayItem(textItem);
}
phi_offset += 4.0 / 180.0 * M_PI;
}
@@ -351,6 +359,7 @@ void JFJochDiffractionImage::loadImage(std::shared_ptr<const JFJochReaderImage>
W = 0; H = 0;
if (scene())
scene()->clear();
resetScenePointers();
hover_resolution = NAN;
hover_resolution_item = nullptr;
@@ -415,6 +424,9 @@ void JFJochDiffractionImage::DrawCross(float x, float y, float size, float width
horizontalLine->setZValue(z); // Ensure it appears above other items
verticalLine->setZValue(z); // Ensure it appears above other items
addOverlayItem(horizontalLine);
addOverlayItem(verticalLine);
}
void JFJochDiffractionImage::showSaturation(bool input) {
@@ -457,6 +469,7 @@ void JFJochDiffractionImage::DrawResolutionText() {
QString("d = %1 Å").arg(QString::number(hover_resolution, 'f', 2));
// Create the item if it does not exist yet; otherwise reuse it
// NOTE: hover_resolution_item is NOT tracked in overlay_items_ — it is persistent
if (!hover_resolution_item) {
hover_resolution_item = scn->addText(label, font);
hover_resolution_item->setZValue(10.0);
@@ -480,9 +493,9 @@ void JFJochDiffractionImage::DrawResolutionText() {
}
void JFJochDiffractionImage::beforeOverlayCleared() {
// The scene is about to clear (and delete) all its items.
// Drop our non-owning pointer so we never touch a deleted item.
hover_resolution_item = nullptr;
// hover_resolution_item is NOT in overlay_items_, so the selective clear won't touch it.
// However, if scene()->clear() is ever called (e.g. on loadImage(nullptr)),
// the caller must also set hover_resolution_item = nullptr separately.
}
void JFJochDiffractionImage::leaveEvent(QEvent *event) {
@@ -492,4 +505,4 @@ void JFJochDiffractionImage::leaveEvent(QEvent *event) {
DrawResolutionText();
}
JFJochImage::leaveEvent(event);
}
}