jfjoch_viewer: Change handling resolution rings

This commit is contained in:
2025-11-18 16:46:10 +01:00
parent 96db052c31
commit 8b7e31548f
8 changed files with 213 additions and 111 deletions

View File

@@ -146,6 +146,9 @@ void JFJochDiffractionImage::DrawPredictions() {
}
void JFJochDiffractionImage::DrawResolutionRings() {
if (ring_mode == RingMode::None)
return;
// Get the visible area in the scene coordinates
QRectF visibleRect = mapToScene(viewport()->geometry()).boundingRect();
@@ -159,7 +162,8 @@ void JFJochDiffractionImage::DrawResolutionRings() {
auto geom = image->Dataset().experiment.GetDiffractionGeometry();
geom.PoniRot3_rad(0.0);
if (res_ring_auto) {
if (ring_mode == RingMode::Auto) {
float radius_x_0 = geom.GetBeamX_pxl() - startX;
float radius_x_1 = endX - geom.GetBeamX_pxl();
@@ -183,8 +187,16 @@ void JFJochDiffractionImage::DrawResolutionRings() {
};
else
res_ring = {};
} else if (ring_mode == RingMode::Estimation) {
if (image && image->ImageData().resolution_estimate)
res_ring = {*image->ImageData().resolution_estimate};
else
res_ring = {};
}
if (res_ring.empty())
return;
QPen pen(feature_color, 5);
pen.setCosmetic(true);
@@ -278,7 +290,6 @@ void JFJochDiffractionImage::addCustomOverlay() {
DrawSpots();
if (show_predictions)
DrawPredictions();
if (show_saturation)
DrawSaturation();
}
@@ -316,12 +327,7 @@ void JFJochDiffractionImage::setAutoForeground(bool input) {
void JFJochDiffractionImage::setResolutionRing(QVector<float> v) {
res_ring = v;
res_ring_auto = false;
updateOverlay();
}
void JFJochDiffractionImage::setResolutionRingAuto() {
res_ring_auto = true;
ring_mode = RingMode::Manual;
updateOverlay();
}
@@ -385,3 +391,8 @@ void JFJochDiffractionImage::changeForeground(float val) {
emit autoForegroundChanged(false);
JFJochImage::changeForeground(val);
}
void JFJochDiffractionImage::setResolutionRingMode(RingMode mode) {
ring_mode = mode;
updateOverlay();
}