// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include #include #include "../../common/UnitCell.h" #include "../../reader/JFJochReaderImage.h" #include "../../image_analysis/geom_refinement/PowderCalibration.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; bool refine_tilt = true; // false pins rot1/rot2 where they are (a calibration meant for XDS) }; // 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; // Taken with the cell, and used with it: the ring list a user-supplied cell produces has to carry // the group's absences, or the fit pairs the innermost OBSERVED ring with a forbidden one. std::optional sample_sg; QComboBox* calibrantCombo{nullptr}; // stores current calibrant selection QComboBox* methodCombo{nullptr}; // rings / spots, for the whole-dataset run QCheckBox* refineTiltCheck{nullptr};// fit the detector tilt, or hold it where it is std::vector GetCalibrantRings() const; void updateCalibrantList(); signals: void ringsFromCalibration(QVector v); void findBeamCenter(QVector ring_q, bool guess, bool refine_tilt); public: PowderCalibrationWidget(QWidget* parent); CalibrationSelection Selection() const; public slots: void loadImage(std::shared_ptr image); private slots: void findBeamCenterClicked(); void optimizeBeamCenterClicked(); };