v1.0.0-rc.81

This commit is contained in:
2025-09-21 19:27:51 +02:00
parent 3ded4cd3ce
commit 5d9d2de4a4
243 changed files with 3401 additions and 935 deletions
+61 -11
View File
@@ -4,6 +4,48 @@
#include "JFJochViewerImageStatistics.h"
#include <QFormLayout>
static QString mkSourceInstrumentText(const DiffractionExperiment& exp) {
QString src, inst;
const auto &m = exp.GetInstrumentMetadata();
if (!m.GetSourceName().empty()) src = QString::fromStdString(m.GetSourceName());
if (!m.GetInstrumentName().empty()) inst = QString::fromStdString(m.GetInstrumentName());
if (!src.isEmpty() && !inst.isEmpty()) return src + " / " + inst;
if (!src.isEmpty()) return src;
if (!inst.isEmpty()) return inst;
return QString("-");
}
static QString mkSourceInstrumentTooltip(const DiffractionExperiment &exp) {
QStringList tooltips;
if (exp.GetRingCurrent_mA().has_value()) {
tooltips << QString("Ring current: <b>%1</b> mA").arg(exp.GetRingCurrent_mA().value(), 0, 'f', 2);
}
if (exp.GetTotalFlux().has_value()) {
tooltips << QString("Total flux: <b>%1</b> ph/s").arg(exp.GetTotalFlux().value(), 0, 'e', 2);
}
if (exp.GetAttenuatorTransmission().has_value()) {
tooltips << QString("Attenuation: <b>%1</b>").arg(exp.GetAttenuatorTransmission().value(), 0, 'f', 3);
}
return tooltips.join("<br/>");
}
static QString mkSampleText(const DiffractionExperiment& exp) {
const auto& name = exp.GetSampleName();
return name.empty() ? QString("-") : QString::fromStdString(name);
}
static QString mkSampleTooltip(const DiffractionExperiment& exp) {
if (exp.GetSampleTemperature_K().has_value()) {
return QString("Sample temperature: <b>%1</b> K").arg(exp.GetSampleTemperature_K().value(), 0, 'f', 2);
}
return QString();
}
JFJochViewerImageStatistics::JFJochViewerImageStatistics(QWidget *parent) : QWidget(parent) {
QFormLayout* layout = new QFormLayout(this);
@@ -13,8 +55,11 @@ JFJochViewerImageStatistics::JFJochViewerImageStatistics(QWidget *parent) : QWid
detector_name = new QLabel(this);
layout->addRow(new QLabel("Detector:"), detector_name);
sample_temperature_K = new QLabel(this);
layout->addRow(new QLabel("Sample temperature:"), sample_temperature_K);
source_name = new QLabel(this);
layout->addRow("Source / Instrument:", source_name);
sample_name = new QLabel(this);
layout->addRow("Sample:", sample_name);
error_pixels = new QLabel(this);
layout->addRow(new QLabel("Error pixels:"), error_pixels);
@@ -56,6 +101,8 @@ JFJochViewerImageStatistics::JFJochViewerImageStatistics(QWidget *parent) : QWid
void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderImage> image) {
if (!image) {
source_name->setText("");
sample_name->setText("");
dataset_name->setText("");
dataset_name->setToolTip("");
detector_name->setText("");
@@ -71,7 +118,6 @@ void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderIm
roi_mean->setText("");
roi_stddev->setText("");
roi_max->setText("");
sample_temperature_K->setText("");
b_factor->setText("");
profile_radius->setText("");
return;
@@ -90,7 +136,6 @@ void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderIm
.arg(QString::number(exp.GetIncidentEnergy_keV() * 1000.0, 'f', 0))
.arg(QString::number(exp.GetWavelength_A(), 'f', 3)));
text = QString("<b>%1</b>").arg(QString::fromStdString(exp.GetDetectorDescription()));
detector_name->setToolTip(QString("Width: <b>%1</b> pxl (<b>%2</b> mm)<br/>Height: <b>%3</b> pxl (<b>%4</b> mm)<br/>Pixel size: <b>%5</b> μm")
.arg(QString::number(exp.GetXPixelsNum()))
@@ -100,6 +145,12 @@ void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderIm
.arg(QString::number(exp.GetPixelSize_mm() * 1000.0, 'f', 0)));
detector_name->setText(text);
source_name->setText(mkSourceInstrumentText(exp));
source_name->setToolTip(mkSampleTooltip(exp));
sample_name->setText(mkSampleText(exp));
sample_name->setToolTip(mkSampleTooltip(exp));
text = QString("<b>%1</b>").arg(image->ErrorPixels().size());
error_pixels->setText(text);
@@ -108,6 +159,12 @@ void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderIm
text = QString("<b>%1</b>").arg(image->ImageData().spots.size());
spots->setText(text);
if (image->ImageData().spot_count.has_value())
spots->setToolTip(QString("Unfiltered (total): <b>%1</b> <br/>Low resolution: <b>%2</b><br/>Ice ring: <b>%3</b><br/>Indexed <b>%4</b><br/>")
.arg(image->ImageData().spot_count.value())
.arg(image->ImageData().spot_count_low_res.value_or(0))
.arg(image->ImageData().spot_count_ice_rings.value_or(0))
.arg(image->ImageData().spot_count_indexed.value_or(0)));
text = QString("<b>%1</b> - <b>%2</b>")
.arg(image->ValidPixels().begin()->first)
@@ -121,13 +178,6 @@ void JFJochViewerImageStatistics::loadImage(std::shared_ptr<const JFJochReaderIm
bkg_estimate->setText("N/A");
}
auto temp = exp.GetSampleTemeperature_K();
if (temp.has_value()) {
text = QString("<b>%1</b> K").arg(QString::number(temp.value(),'f',2));
sample_temperature_K->setText(text);
} else
sample_temperature_K->setText("N/A");
auto mos = image->ImageData().profile_radius;
if (mos) {
text = QString("<b>%1</b> Å<sup>-1</sup>").arg(QString::number(mos.value(), 'f', 6));