DynExp
Highly flexible laboratory automation for dynamically changing experiments.
WidefieldMicroscopeWidget.h
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
8 #pragma once
9 
10 #include "stdafx.h"
11 #include "DynExpCore.h"
12 
13 #include <QWidget>
14 #include "ui_WidefieldMicroscope.h"
15 
17 {
18  class WidefieldMicroscope;
19  class WidefieldMicroscopeData;
20 
21  enum class StateType {
22  DummyState, // To be temporarily replaced by a StataMachine's context.
28  Ready,
59  Waiting,
60  WaitingFinished, // To be temporarily replaced by a StataMachine's context.
85  };
86 
88 
90  {
91  Q_OBJECT
92 
93  private:
95  {
97 
98  void Update();
99 
102 
103  QLabel* StateLabel;
104  QLabel* CellIDLabel;
106  QLabel* HomePosLabel;
107  QLabel* PumpPowerLabel;
110  QLabel* XCoordLabel;
111  QLabel* YCoordLabel;
112  };
113 
115 
116  public:
118 
121 
122  bool AllowResize() const noexcept override final { return true; }
123 
124  const WidefieldMicroscope& GetCastOwner() const noexcept;
125 
126  void InitializeUI(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
127  void SetUIState(const StateMachineStateType* State, const Util::StateMachineContext<StateMachineStateType>* Context,
128  Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
129  void UpdateUIData(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
130  void UpdateWidefieldUIData(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
131  void UpdateConfocalUIData(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
132  void UpdateHBTUIData(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData);
133  void UpdateAutoMeasureUIData(Util::SynchronizedPointer<WidefieldMicroscopeData>& ModuleData, bool IsCharacterizingSample);
134 
135  const auto& GetUI() const noexcept { return ui; }
137  const auto& GetMainGraphicsView() const noexcept { return MainGraphicsView; }
138  const auto& GetConfocalSurface3DSeries() const noexcept { return ConfocalSurface3DSeries; }
139  bool GetUIInitialized() const noexcept { return UIInitialized; }
140 
141  void SetMainGraphicsImage(const QImage& Image) noexcept;
142  void UpdateScene();
143 
144  private:
146 
147  bool eventFilter(QObject* obj, QEvent* event) override;
148  virtual void resizeEvent(QResizeEvent* event) override;
149 
155 
156  Ui::WidefieldMicroscope ui;
158 
160 
163  QGraphicsPixmapItem* MainGraphicsPixmapItem;
164  QGraphicsScene* MainGraphicsScene;
167 
169 
171  Q3DSurface* ConfocalGraph;
173  QSurfaceDataProxy* ConfocalSurfaceDataProxy;
174  QSurfaceDataArray* ConfocalSurfaceDataArray;
175  QSurface3DSeries* ConfocalSurface3DSeries;
179 
180  QXYSeries* HBTDataSeries;
181  QChart* HBTDataChart;
182  QValueAxis* HBTXAxis;
183  QValueAxis* HBTYAxis;
184 
185  bool UIInitialized = false;
186 
187  QPoint MarkerPos;
188  QPointF SamplePos;
191 
192  private slots:
193  void OnSaveImageClicked();
194  void OnZoomResetClicked();
195  void OnZoomInClicked();
196  void OnZoomOutClicked();
197  void OnZoomFitClicked(bool Checked);
198  void OnImageMouseMove(QMouseEvent* Event);
199  void OnCellIDContextMenuRequested(const QPoint& Position);
200  void OnEmitterListCellClicked(int Row, int Column);
201  void OnEmitterListCellDoubleClicked(int Row, int Column);
202  void OnEmitterListContextMenuRequested(const QPoint& Position);
212  };
213 }
Defines DynExp's core module as an interface between the UI and DynExp objects.
bool eventFilter(QObject *obj, QEvent *event) override
void UpdateHBTUIData(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
WidefieldMicroscopeWidget(WidefieldMicroscope &Owner, QModuleWidget *parent=nullptr)
Util::MarkerGraphicsView::MarkerType::IDType MarkerID
void UpdateConfocalUIData(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
void SetUIState(const StateMachineStateType *State, const Util::StateMachineContext< StateMachineStateType > *Context, Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
void UpdateUIData(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
bool StoreTWEmitterListSelection()
Stores the values of the respective cells of ui.TWEmitterList's currently selected row in MarkerPos a...
virtual void resizeEvent(QResizeEvent *event) override
void InitializeUI(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
void UpdateAutoMeasureUIData(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData, bool IsCharacterizingSample)
bool AllowResize() const noexcept override final
Indicates the resizing behavior of the user interface window. Override to adjust.
void UpdateWidefieldUIData(Util::SynchronizedPointer< WidefieldMicroscopeData > &ModuleData)
const WidefieldMicroscope & GetCastOwner() const noexcept
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
Definition: Module.h:793
Window class for Qt-based user interfaces belonging to DynExp modules. User interface Qt window class...
Definition: Module.h:1079
QModuleBase & Owner
Module owning this user interface window (reference, because it should never change nor be nullptr).
Definition: Module.h:1162
QModuleWidget(QModuleBase &Owner, QWidget *Parent=nullptr)
Constructs a QModuleWidget instance.
Definition: Module.cpp:417
Implements a QGraphicsView the user can interact with to insert graphical markers....
Definition: QtUtil.h:379
State machine context as used by class StateMachine. A state machine context holds a map with keys an...
Definition: Util.h:1362
State machine state as used by class StateMachine. A state mainly wraps a state function of the membe...
Definition: Util.h:1305
DynExp's Util namespace contains commonly used functions and templates as well as extensions to Qt an...
Definition: circularbuf.cpp:7
Accumulates include statements to provide a precompiled header.
const Util::StateMachineContext< StateMachineStateType > * CurrentContext