// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include "../../common/UnitCell.h" #include "../../reader/JFJochReaderImage.h" #include "../../rugnux/RugnuxCalibration.h" // CalibrationMethod // What a whole-dataset calibration run is set to. The analysis library takes the calibrant as a ring // list rather than a name (ice has no cell to enumerate rings from), so the name is resolved here. struct CalibrationSelection { QString name; std::vector ring_q; // q = 2*pi/d [1/A], ascending CalibrationMethod method = CalibrationMethod::Rings; }; // Detector geometry from a powder standard: the calibrant, and how its rings are measured. The two // buttons fit the image currently on screen; "Analyze dataset" reads Selection() and fits the whole // dataset the same way rugnux --mode calibration does. class PowderCalibrationWidget : public QWidget { Q_OBJECT std::optional sample_cell; QComboBox* calibrantCombo{nullptr}; // stores current calibrant selection QComboBox* methodCombo{nullptr}; // rings / spots, for the whole-dataset run std::vector GetCalibrantRings() const; void updateCalibrantList(); signals: void ringsFromCalibration(QVector v); void findBeamCenter(QVector ring_q, bool guess); public: PowderCalibrationWidget(QWidget* parent); CalibrationSelection Selection() const; public slots: void loadImage(std::shared_ptr image); private slots: void findBeamCenterClicked(); void optimizeBeamCenterClicked(); };