Build Packages / Create release (push) Successful in 26s
Build Packages / Build documentation (push) Successful in 1m43s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m7s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 11m48s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 7m22s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 12m24s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m30s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m29s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m41s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 21m44s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 24m41s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 26m9s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m3s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 28m28s
Build Packages / Generate python client (push) Successful in 27s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 31m16s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m44s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 26m27s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 22m52s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 27m44s
Build Packages / Unit tests (push) Successful in 1h46m55s
Build Packages / Validation Battery (push) Successful in 52m50s
* Rugnux: Several rotation sweeps of one crystal are merged as one dataset (`rugnux a_master.h5 b_master.h5`), on a common indexing and cell, with a non-isomorphous sweep left out and reported; `--sweeps separate` processes each sweep on its own. Bruker `.sfrm` frames and imgCIF files with a full goniometer axis chain are read. * Rugnux: More robust rotation processing - a retry with a more sensitive spot finder when no lattice is found, a self-consistent detector distance, long axes and doubled cells tested as hypotheses, a `-C` supercell multiple stepped down, and each ice ring merged, down-weighted or rejected on its own. * Rugnux: Serial stills are merged with a partiality-aware error model, reported as `ERROR_MODEL_A/B/C` with no ISa or R_merge/R_meas/R_pim; runs without `-S` have an overall intensity scale about 0.86-0.88 times that of earlier versions, with unchanged statistics. A second crystal form is left out of the merge and reported, the indexing ambiguity is resolved more reliably, and `--model` no longer influences processing. * Rugnux: The reported CC1/2 is the standard unweighted one, which can be lower than before on sweeps with weak frames; ISa comes with a 95% interval (`ISA_LOW`/`ISA_HIGH`). * Rugnux: Model refinement adds anisotropic/TLS, local NCS and twin refinement where R-free supports them; building waters and relabelling ions is now off by default (`--refine-solvent` turns it on). * NXmx: A detector of several modules is written as `module_0` ... `module_N` only, so DIALS reads each module as its own panel. * Other: JPEG previews use a bundled encoder (libjpeg-turbo no longer needed), Rugnux prints how to cite it, and the release archives contain the HTML documentation. Reviewed-on: #92 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
140 lines
6.9 KiB
C++
140 lines
6.9 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <QElapsedTimer>
|
|
#include <QMainWindow>
|
|
#include <QProgressDialog>
|
|
#include <QTimer>
|
|
|
|
#include "JFJochViewerMenu.h"
|
|
#include "../reader/JFJochHDF5Reader.h"
|
|
#include "JFJochImageReadingWorker.h"
|
|
#include "JFJochViewerDatasetInfo.h"
|
|
#include "JFJochViewerStatusBar.h"
|
|
#include "toolbar/JFJochViewerToolbarDisplay.h"
|
|
|
|
class JFJochProcessingJobsWindow;
|
|
class JFJochDiffractionImage;
|
|
class JFJochHelperWindow;
|
|
class JFJochViewerMagnifier;
|
|
class QDockWidget;
|
|
class QScrollArea;
|
|
|
|
class JFJochViewerWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
// Theming is done via the application palette in main() (salmon panels, white entry fields,
|
|
// navy accent) so it applies consistently to every widget, including dialogs.
|
|
public:
|
|
explicit JFJochViewerWindow(QWidget *parent = nullptr, bool dbus = true, const QString &file = "");
|
|
~JFJochViewerWindow() override;
|
|
|
|
private:
|
|
JFJochViewerMenu *menuBar;
|
|
JFJochImageReadingWorker *reading_worker;
|
|
JFJochDiffractionImage *viewer; // central diffraction image
|
|
JFJochViewerToolbarDisplay *toolBarDisplay;
|
|
JFJochViewerStatusBar *statusbar;
|
|
JFJochProcessingJobsWindow *processingJobsWindow;
|
|
|
|
std::shared_ptr<const JFJochReaderDataset> lastDataset; // added
|
|
std::shared_ptr<const JFJochReaderImage> lastImage; // added
|
|
|
|
// Remote-display frame throttle (see OnImageReady): the newest frame not yet fanned out,
|
|
// delivered at most every kRemoteRepaintIntervalMs while a fast producer runs.
|
|
std::shared_ptr<const JFJochReaderImage> pendingImage;
|
|
QElapsedTimer image_rate_;
|
|
QTimer *image_tail_timer_ = nullptr;
|
|
void DeliverPendingImage();
|
|
QVector<RunData> lastRuns; // for dataset-info docks opened later
|
|
QString lastActiveRunId;
|
|
|
|
QProgressDialog *retryDialog = nullptr;
|
|
|
|
QDockWidget *lastDatasetInfoDock = nullptr; // most recent dataset-info dock, for docking layout
|
|
int64_t rangeFirst = -1, rangeLast = -1; // image range picked on a plot, for a plot opened later
|
|
QDockWidget *inspectorDock = nullptr; // image inspector (former right-hand side panel)
|
|
QScrollArea *inspectorScroll = nullptr; // its scroll area; width bounds follow the font
|
|
QDockWidget *settingsDock = nullptr; // inline MX/AzInt settings panel
|
|
QDockWidget *fileBrowserDock = nullptr; // data-root directory tree, tabbed with settingsDock
|
|
QDockWidget *processingDock = nullptr; // processing jobs panel
|
|
JFJochViewerMagnifier *magnifier = nullptr;
|
|
QDockWidget *magnifierDock = nullptr; // where the magnifier normally sits
|
|
JFJochHelperWindow *magnifierWindow = nullptr; // ... and its window when popped out
|
|
void PopOutMagnifier();
|
|
QByteArray defaultLayoutState; // captured after construction, for "Reset layout"
|
|
int datasetInfoCounter = 0; // gives each dataset-info dock a unique objectName
|
|
|
|
void ResetAllSettings();
|
|
void UpdateInspectorWidth();
|
|
|
|
// A narrow window folds the inspector away (with the magnifier, when it is docked in the same
|
|
// column) so the image keeps its room, and brings it back once the window is wide enough again.
|
|
QList<QDockWidget *> autoHiddenDocks; // hidden by the window, not by the user
|
|
int autoHiddenWidth = 0; // the inspector column's width when it was folded away
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
// Both ways of opening a dataset from outside the file manager - the File menu and D-Bus -
|
|
// come through here, so the browser follows the same way for either.
|
|
void FollowInFileBrowser(const QString &filename);
|
|
|
|
QThread *reading_thread;
|
|
|
|
// Named layouts. Image = just the image + inspector; Processing = also the plots + jobs panel.
|
|
enum class Perspective { Image, Processing };
|
|
void ApplyPerspective(Perspective p);
|
|
|
|
// Keyboard shortcuts (F/B/A, Home/End/PageUp/PageDown) are handled in an application-wide
|
|
// event filter rather than keyPressEvent, so they work wherever the focus happens to be,
|
|
// stepping aside when the focused widget genuinely uses the key (text entry, item views).
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
void closeEvent(QCloseEvent *event) override;
|
|
void changeEvent(QEvent *event) override;
|
|
|
|
private slots:
|
|
// Single cross-thread sink for the worker's imageLoaded: fans out to every GUI consumer
|
|
// (synchronously, same thread) via imageReady, then acks the worker so it may produce the next.
|
|
void OnImageReady(std::shared_ptr<const JFJochReaderImage> image);
|
|
|
|
// Single cross-thread sink for the worker's datasetLoaded, mirroring OnImageReady: fans out to
|
|
// every GUI consumer synchronously via datasetReady, then acks the worker (datasetConsumed) so the
|
|
// worker can cap how many datasets are in flight - without this the queued datasetLoaded backlog
|
|
// (each event pinning a full dataset) grew without bound in live follow (100 GB OOM).
|
|
void OnDatasetReady(std::shared_ptr<const JFJochReaderDataset> dataset);
|
|
|
|
public slots:
|
|
void LoadFile(const QString &filename, qint64 image_number, qint64 summation, bool retry);
|
|
void LoadImage(qint64 image_number, qint64 summation);
|
|
// The bearer token for a protected broker dataset. Sources, each overriding the previous:
|
|
// JUNGFRAUJOCH_HTTP_TOKEN at start-up, D-Bus, the Open HTTP Connection dialog.
|
|
void SetHttpToken(const QString &token);
|
|
void NewDatasetInfo();
|
|
void OnFileLoadError(QString title, QString message);
|
|
void OnFileLoadRetryStatus(bool active, QString message);
|
|
|
|
signals:
|
|
// Internal GUI-thread fan-out of the newest frame: OnImageReady re-emits this to every GUI
|
|
// consumer synchronously, then acks via imageConsumed (see OnImageReady).
|
|
void imageReady(std::shared_ptr<const JFJochReaderImage> image);
|
|
void imageConsumed(); // ack to the worker that one frame has been consumed (backpressure)
|
|
|
|
// Same GUI-thread fan-out + ack for the dataset stream (see OnDatasetReady).
|
|
void datasetReady(std::shared_ptr<const JFJochReaderDataset> dataset);
|
|
void datasetConsumed(); // ack to the worker that one dataset has been consumed (backpressure)
|
|
|
|
void LoadFileRequest(const QString &filename, qint64 image_number, qint64 summation, bool retry);
|
|
void LoadImageRequest(int64_t image_number, int64_t summation);
|
|
void HttpTokenRequest(QString token);
|
|
void adjustForegroundButton(bool input);
|
|
void adjustBackgroundButton(bool input);
|
|
void setAutoForeground(bool val);
|
|
void oneShotAutoForeground();
|
|
// Re-emitted by the shortcut filter; the navigation toolbar applies the step, clamped.
|
|
void stepImage(int steps);
|
|
// An image range picked on a plot (-1, -1 = cleared), and a request to process it.
|
|
void imageRangeSelected(int64_t first, int64_t last);
|
|
void processRangeRequested();
|
|
};
|
|
|