All checks were successful
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m46s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 7m52s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m9s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m11s
Build Packages / Generate python client (push) Successful in 14s
Build Packages / Build documentation (push) Successful in 39s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m26s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m51s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m36s
Build Packages / build:rpm (rocky9) (push) Successful in 9m20s
Build Packages / Unit tests (push) Successful in 1h12m50s
This is an UNSTABLE release. * jfjoch_viewer: Add keyboard shortcuts and option to copy image to clipboard * jfjoch_broker: Fix bit-width and exposure time for PSI EIGER detectors Reviewed-on: #15 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch> Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
124 lines
3.9 KiB
C++
124 lines
3.9 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#ifndef JFJOCHIMAGEREADINGWORKER_H
|
|
#define JFJOCHIMAGEREADINGWORKER_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QVector>
|
|
#include <QRect>
|
|
#include <QMutex>
|
|
#include <QTimer>
|
|
|
|
#include "../reader/JFJochHDF5Reader.h"
|
|
#include "../common/Logger.h"
|
|
#include "../reader/JFJochHttpReader.h"
|
|
#include "../image_analysis/MXAnalysisWithoutFPGA.h"
|
|
#include "SimpleImage.h"
|
|
|
|
Q_DECLARE_METATYPE(std::shared_ptr<const JFJochReaderDataset>)
|
|
Q_DECLARE_METATYPE(std::shared_ptr<const JFJochReaderImage>)
|
|
Q_DECLARE_METATYPE(DiffractionExperiment)
|
|
Q_DECLARE_METATYPE(SpotFindingSettings)
|
|
Q_DECLARE_METATYPE(IndexingSettings)
|
|
Q_DECLARE_METATYPE(AzimuthalIntegrationSettings)
|
|
|
|
Q_DECLARE_METATYPE(UnitCell)
|
|
Q_DECLARE_METATYPE(std::shared_ptr<const SimpleImage>)
|
|
|
|
class JFJochImageReadingWorker : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum class AutoloadMode {HTTPSync, Movie, None};
|
|
Q_ENUM(AutoloadMode)
|
|
private:
|
|
mutable QMutex m;
|
|
bool http_mode = false;
|
|
|
|
AutoloadMode autoload_mode = AutoloadMode::None;
|
|
|
|
JFJochHDF5Reader file_reader;
|
|
JFJochHttpReader http_reader;
|
|
|
|
QString current_file;
|
|
|
|
DiffractionExperiment curr_experiment;
|
|
IndexingSettings indexing_settings;
|
|
AzimuthalIntegrationSettings azint_settings;
|
|
std::unique_ptr<IndexerThreadPool> indexing;
|
|
|
|
std::shared_ptr<JFJochReaderImage> current_image_ptr;
|
|
std::unique_ptr<AzimuthalIntegration> azint_mapping;
|
|
std::unique_ptr<MXAnalysisWithoutFPGA> image_analysis;
|
|
|
|
std::unique_ptr<ROIElement> roi;
|
|
|
|
SpotFindingSettings spot_finding_settings;
|
|
|
|
std::optional<int64_t> current_image;
|
|
int64_t current_summation = 1;
|
|
int64_t total_images = 0;
|
|
int64_t jump_value = 1;
|
|
Logger logger{"jfjoch_viewer"};
|
|
|
|
bool auto_reanalyze = false;
|
|
|
|
QTimer *autoload_timer;
|
|
int autoload_interval = 500; // milliseconds
|
|
|
|
void LoadImage_i(int64_t image_number, int64_t summation);
|
|
void ReanalyzeImage_i();
|
|
void UpdateDataset_i(const std::optional<DiffractionExperiment>& experiment);
|
|
void UpdateAzint_i(const JFJochReaderDataset *dataset);
|
|
void UpdateUserMask_i(const std::vector<uint32_t> &mask);
|
|
void setAutoLoadMode_i(AutoloadMode mode);
|
|
|
|
signals:
|
|
void datasetLoaded(std::shared_ptr<const JFJochReaderDataset>);
|
|
void imageLoaded(std::shared_ptr<const JFJochReaderImage>);
|
|
void imageStatsUpdated(std::shared_ptr<const JFJochReaderImage>);
|
|
void imageNumberChanged(int64_t total_images, int64_t current_image);
|
|
void setRings(const QVector<float> &v);
|
|
void simpleImageLoaded(std::shared_ptr<const SimpleImage> image);
|
|
void autoloadChanged(AutoloadMode mode);
|
|
|
|
public:
|
|
JFJochImageReadingWorker(const SpotFindingSettings &settings, const DiffractionExperiment& experiment, QObject *parent = nullptr);
|
|
~JFJochImageReadingWorker() override = default;
|
|
|
|
private slots:
|
|
void AutoLoadTimerExpired();
|
|
|
|
public slots:
|
|
void LoadFile(const QString &filename, qint64 image_number, qint64 summation);
|
|
void CloseFile();
|
|
void LoadImage(int64_t image_number, int64_t summation);
|
|
void SetROIBox(QRect box);
|
|
void SetROICircle(double x, double y, double radius);
|
|
|
|
void UpdateDataset(const DiffractionExperiment& experiment);
|
|
|
|
void FindCenter(const UnitCell& calibrant, bool guess);
|
|
|
|
void Analyze();
|
|
|
|
void UpdateSpotFindingSettings(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots);
|
|
void ReanalyzeImages(bool input);
|
|
void UpdateAzintSettings(const AzimuthalIntegrationSettings& settings);
|
|
void AddROIToUserMask();
|
|
void SubtractROIFromUserMask();
|
|
|
|
void SaveUserMaskTIFF(QString filename);
|
|
void UploadUserMask();
|
|
void ClearUserMask();
|
|
|
|
void LoadCalibration(QString dataset);
|
|
void setAutoLoadMode(AutoloadMode mode);
|
|
void setAutoLoadJump(int64_t val);
|
|
};
|
|
|
|
|
|
#endif //JFJOCHIMAGEREADINGWORKER_H
|