CalibrateFromProfile/CalibrateFromSpots/WritePoniFile sat in rugnux/, so the
only way to reach them was to link the Rugnux library - which drags in
JFJochWriter and gemmi. Nothing in them needs either: the includes are all
common/ and image_analysis/geom_refinement/, next to the RingOptimizer and
RingsFromProfile they call.
Moving them to image_analysis/geom_refinement/PowderCalibration.{h,cpp} puts
the powder fit beside the rest of the geometry refinement and makes it
reachable from anything that already links JFJochImageAnalysis - the receiver
and so the broker included, which is what an online geometry calibration would
need.
Pure move: the file contents differ from their previous form only in the
include paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NfuDvf5ipV3Hi8TiCUKD27
49 lines
1.9 KiB
C++
49 lines
1.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 <QWidget>
|
|
#include <QCheckBox>
|
|
#include <QComboBox>
|
|
#include <QVector>
|
|
#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<float> 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<UnitCell> sample_cell;
|
|
|
|
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<float> GetCalibrantRings() const;
|
|
|
|
void updateCalibrantList();
|
|
signals:
|
|
void ringsFromCalibration(QVector<float> v);
|
|
void findBeamCenter(QVector<float> ring_q, bool guess, bool refine_tilt);
|
|
public:
|
|
PowderCalibrationWidget(QWidget* parent);
|
|
CalibrationSelection Selection() const;
|
|
public slots:
|
|
void loadImage(std::shared_ptr<const JFJochReaderImage> image);
|
|
private slots:
|
|
void findBeamCenterClicked();
|
|
void optimizeBeamCenterClicked();
|
|
};
|