91 lines
2.5 KiB
C++
91 lines
2.5 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 <QVector>
|
|
#include "../../reader/JFJochHDF5Reader.h"
|
|
#include "../../common/ColorScale.h"
|
|
|
|
class JFJochDiffractionImage : public JFJochImage {
|
|
Q_OBJECT
|
|
|
|
bool auto_foreground = false;
|
|
|
|
QColor spot_color = Qt::green;
|
|
QColor prediction_color = Qt::darkRed;
|
|
QColor ice_ring_color = Qt::cyan;
|
|
|
|
QRectF roi_box;
|
|
|
|
public:
|
|
JFJochDiffractionImage(QWidget *parent = nullptr);
|
|
signals:
|
|
void roiBoxUpdated(QRect box);
|
|
void roiCircleUpdated(double x, double y, double radius);
|
|
private:
|
|
void mousePressEvent(QMouseEvent *event) override; // Panning start
|
|
void mouseMoveEvent(QMouseEvent *event) override; // Panning interaction
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
void updateOverlay() override;
|
|
void Redraw() override;
|
|
|
|
void updateROI();
|
|
|
|
void LoadImageInternal();
|
|
void DrawResolutionRings();
|
|
void DrawSpots();
|
|
void DrawPredictions();
|
|
void DrawBeamCenter();
|
|
void DrawTopPixels();
|
|
void DrawSaturation();
|
|
void DrawCross(float x, float y, float size, float width, float z = 1);
|
|
|
|
std::shared_ptr<const JFJochReaderImage> image;
|
|
|
|
int32_t show_highest_pixels = 0;
|
|
|
|
QVector<float> res_ring = {};
|
|
bool res_ring_auto = false;
|
|
bool show_spots = true;
|
|
bool show_predictions = false;
|
|
bool show_saturation = false;
|
|
bool highlight_ice_rings = true;
|
|
|
|
float ice_ring_width_Q_recipA = 0.01;
|
|
QPoint lastMousePos; // To track panning movement
|
|
|
|
QPointF roiStartPos;
|
|
QPointF roiEndPos;
|
|
|
|
enum class RoiType {RoiBox, RoiCircle};
|
|
enum class MouseEventType {None, Panning, DrawingROI, MovingROI};
|
|
MouseEventType mouse_event_type = MouseEventType::None;
|
|
RoiType roi_type = RoiType::RoiBox;
|
|
|
|
public slots:
|
|
void loadImage(std::shared_ptr<const JFJochReaderImage> image);
|
|
void setAutoForeground(bool input);
|
|
|
|
void setResolutionRing(QVector<float> v);
|
|
void setResolutionRingAuto();
|
|
void showSpots(bool input);
|
|
void showPredictions(bool input);
|
|
|
|
void setSpotColor(QColor input);
|
|
void setPredictionColor(QColor input);
|
|
|
|
void showHighestPixels(int32_t v);
|
|
void showSaturation(bool input);
|
|
|
|
void highlightIceRings(bool input);
|
|
void centerOnSpot(QPointF point);
|
|
|
|
void SetROIBox(QRect box);
|
|
void SetROICircle(double x, double y, double radius);
|
|
};
|
|
|