Add JFJochViewerROIList to the side panel: a list of the dataset's ROIs with selection, add (box/circle/azimuthal), rename and delete, plus a statistics readout (sum/mean/std/max/valid/masked/centre-of-mass) for the selected ROI, taken from the analysis output for the current image. Edits emit a full ROIDefinition, routed to the worker's SetROIDefinition. Per-ROI statistics now live in this panel rather than the canvas labels; the diffraction image's labels show only the ROI name, and the ad-hoc ROIIntegrationCPU computation there is removed in favour of the analysis pipeline. The result widget now reports std dev instead of variance. The single-ROI scratch panel remains for now and will be retired once the interactive canvas editing replaces it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
88 lines
2.4 KiB
C++
88 lines
2.4 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include "JFJochImage.h"
|
|
#include "../../reader/JFJochReaderImage.h"
|
|
|
|
class ROIAzimuthal;
|
|
class DiffractionGeometry;
|
|
|
|
class JFJochDiffractionImage : public JFJochImage {
|
|
Q_OBJECT
|
|
|
|
QColor spot_color = Qt::green;
|
|
QColor prediction_color = Qt::darkRed;
|
|
QColor ice_ring_color = Qt::cyan;
|
|
|
|
float hover_resolution = NAN;
|
|
QGraphicsTextItem* hover_resolution_item = nullptr; // big text in top-left
|
|
public:
|
|
enum class RingMode {Auto, Estimation, Manual, None, IceRings};
|
|
Q_ENUM(RingMode)
|
|
|
|
JFJochDiffractionImage(QWidget *parent = nullptr);
|
|
private:
|
|
|
|
void addCustomOverlay() override;
|
|
void LoadImageInternal();
|
|
void DrawResolutionRings();
|
|
void DrawROIs();
|
|
void DrawAzimuthalROI(const ROIAzimuthal &az, const QColor &color, const DiffractionGeometry &geom);
|
|
void AddROILabel(const std::string &name, const QColor &color, float px, float py);
|
|
void DrawSpots();
|
|
void DrawPredictions();
|
|
void DrawBeamCenter();
|
|
void DrawTopPixels();
|
|
void DrawSaturation();
|
|
void DrawResolutionText();
|
|
void DrawCross(float x, float y, float size, float width, float z = 1);
|
|
|
|
void UpdateForeground();
|
|
void beforeOverlayCleared() override;
|
|
void leaveEvent(QEvent *event) override;
|
|
|
|
std::shared_ptr<const JFJochReaderImage> image;
|
|
|
|
int32_t show_highest_pixels = 0;
|
|
|
|
QVector<float> res_ring = {};
|
|
|
|
RingMode ring_mode = RingMode::Estimation;
|
|
|
|
bool show_spots = false;
|
|
bool show_predictions = false;
|
|
|
|
bool show_roi_labels = false;
|
|
bool show_roi_fill = false;
|
|
|
|
bool highlight_ice_rings = true;
|
|
|
|
float ice_ring_width_Q_recipA = 0.01;
|
|
|
|
void mouseHover(QMouseEvent* event) override;
|
|
|
|
public slots:
|
|
void loadImage(std::shared_ptr<const JFJochReaderImage> image);
|
|
void setAutoForeground(bool input);
|
|
void setResolutionRing(QVector<float> v);
|
|
void setResolutionRingMode(RingMode mode);
|
|
|
|
void showSpots(bool input);
|
|
void showPredictions(bool input);
|
|
|
|
void showROILabels(bool input);
|
|
void showROIFill(bool input);
|
|
|
|
void setSpotColor(QColor input);
|
|
void setPredictionColor(QColor input);
|
|
|
|
void showHighestPixels(int32_t v);
|
|
void showSaturation(bool input);
|
|
|
|
void highlightIceRings(bool input);
|
|
void setHDRMode(bool input);
|
|
};
|
|
|