jfjoch_viewer: Add option to refine detector settings

This commit is contained in:
2025-10-29 14:57:32 +01:00
parent 549c0fade1
commit 1950694ef2
4 changed files with 33 additions and 6 deletions

View File

@@ -234,7 +234,7 @@ void JFJochImageReadingWorker::Analyze() {
emit imageLoaded(current_image_ptr);
}
void JFJochImageReadingWorker::FindCenter(const UnitCell& calibrant) {
void JFJochImageReadingWorker::FindCenter(const UnitCell& calibrant, bool guess) {
QMutexLocker locker(&m);
if (!current_image_ptr)
return;
@@ -242,7 +242,10 @@ void JFJochImageReadingWorker::FindCenter(const UnitCell& calibrant) {
DiffractionGeometry geom = current_image_ptr->Dataset().experiment.GetDiffractionGeometry();
try {
GuessGeometry(geom, current_image_ptr->ImageData().spots, calibrant);
if (guess)
GuessGeometry(geom, current_image_ptr->ImageData().spots, calibrant);
else
OptimizeGeometry(geom, current_image_ptr->ImageData().spots, calibrant);
} catch (const JFJochException &e) {
logger.ErrorException(e);
return;

View File

@@ -78,7 +78,8 @@ public slots:
void UpdateDataset(const DiffractionExperiment& experiment);
void FindCenter(const UnitCell& calibrant);
void FindCenter(const UnitCell& calibrant, bool guess);
void Analyze();
void UpdateSpotFindingSettings(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots, bool reanalyze);

View File

@@ -126,10 +126,14 @@ JFJochViewerSidePanel::JFJochViewerSidePanel(QWidget *parent) : QWidget(parent)
layout->addWidget(calibrantCombo);
updateCalibrantList();
auto findBeamCenterButton = new QPushButton("Calibrate detector", this);
auto findBeamCenterButton = new QPushButton("Guess detector calibration", this);
connect(findBeamCenterButton, &QPushButton::clicked,this, &JFJochViewerSidePanel::findBeamCenterClicked);
layout->addWidget(findBeamCenterButton);
auto optimizeBeamCenterButton = new QPushButton("Refine detector calibration", this);
connect(optimizeBeamCenterButton, &QPushButton::clicked,this, &JFJochViewerSidePanel::optimizeBeamCenterClicked);
layout->addWidget(optimizeBeamCenterButton);
// Add preset ice rings button below LaB6 calibration
auto iceRingsButton = new QPushButton("Display ice rings", this);
connect(iceRingsButton, &QPushButton::clicked, this, [this]() {
@@ -159,6 +163,24 @@ void JFJochViewerSidePanel::updateCalibrantList() {
calibrantCombo->setCurrentIndex(0);
}
void JFJochViewerSidePanel::optimizeBeamCenterClicked() {
UnitCell uc(LAB6_CELL_A, LAB6_CELL_A, LAB6_CELL_A, 90, 90, 90);
switch (calibrantCombo->currentIndex()) {
case 1:
// T. C. Huang , H. Toraya, T. N. Blanton, Y. Wu, J. Appl. Cryst. 26 (1993), 180-184.
uc = UnitCell(5.1769, 4.7218, 58.380, 89.440, 89.634, 75.854);
break;
case 2:
if (sample_cell)
uc = sample_cell.value();
break;
default:
break;
}
emit findBeamCenter(uc, false);
}
void JFJochViewerSidePanel::findBeamCenterClicked() {
UnitCell uc(LAB6_CELL_A, LAB6_CELL_A, LAB6_CELL_A, 90, 90, 90);
switch (calibrantCombo->currentIndex()) {
@@ -174,7 +196,7 @@ void JFJochViewerSidePanel::findBeamCenterClicked() {
break;
}
emit findBeamCenter(uc);
emit findBeamCenter(uc, true);
}
void JFJochViewerSidePanel::setRings(const QVector <float> &v) {

View File

@@ -34,7 +34,7 @@ signals:
void showSaturatedPixels(bool input);
void showPredictions(bool input);
void highlightIceRings(bool input);
void findBeamCenter(const UnitCell &input);
void findBeamCenter(const UnitCell &input, bool guess);
void analyze();
void imageLoaded(std::shared_ptr<const JFJochReaderImage> image);
@@ -53,6 +53,7 @@ private slots:
void setRings(const QVector<float> &v);
void findBeamCenterClicked();
void optimizeBeamCenterClicked();
void updateCalibrantList();
};