// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include "../../reader/JFJochReaderImage.h" class JFJochImageItem; // A second view of a frame that a JFJochImage has already rendered: the same pixels, with its own // zoom and centre. Nothing is converted or coloured here and there is no second full-size buffer, // so following the main view costs a pointer assignment per frame rather than a whole render. // // Zoomed in far enough it writes the per-pixel counts over the image. Those are read straight from // the detector's int32 buffer - the same source the main view colours from - so no float copy of // the image is needed either. // // It draws no overlays and has no ROI tools: those belong to the view that owns the data. class JFJochFollowerImage : public QGraphicsView { Q_OBJECT static constexpr int kMaxLabels = 2000; JFJochImageItem *item_ = nullptr; std::shared_ptr frame_; QSize frame_size_; // size the scene rect was set from std::shared_ptr> values_; // the counts behind the frame, row by row double zoom_ = 12.0; int label_font_px_ = 0; // 0 = no per-pixel labels QPointF center_; bool center_set_ = false; void wheelEvent(QWheelEvent *event) override; void resizeEvent(QResizeEvent *event) override; void drawForeground(QPainter *painter, const QRectF &rect) override; public: explicit JFJochFollowerImage(QWidget *parent = nullptr); void SetFrame(std::shared_ptr frame); void SetPixelValues(std::shared_ptr> pixels); void CenterAt(QPointF scenePos); // Screen pixels per detector pixel, and the pixel size of the value labels (0 = none) void SetZoom(double zoom, int label_font_px); signals: // The area of the image the view shows, in detector pixels void fieldChanged(QSizeF size); };