DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
PVCam.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
9#pragma once
10
11#include "stdafx.h"
12#include "DynExpCore.h"
15
16namespace DynExpInstr
17{
18 class PVCam;
19
20 namespace PVCamTasks
21 {
28
35
44
45 class SetCameraMode final : public DynExp::TaskBase
46 {
47 public:
49
50 private:
52
53 const size_t ID;
54 };
55
67
69 {
70 public:
72
73 private:
75 };
76
78 {
79 public:
81
82 private:
84 };
85
87 {
88 public:
90
91 private:
93 };
94 }
95
118
120 {
121 public:
123 virtual ~PVCamParams() = default;
124
125 virtual const char* GetParamClassTag() const noexcept override { return "PVCamParams"; }
126
128 "HardwareAdapter", "PVCam camera", "Underlying hardware adapter of this instrument", DynExpUI::Icons::HardwareAdapter };
129
130 private:
133 };
134
136 {
137 public:
140
141 PVCamConfigurator() = default;
142 virtual ~PVCamConfigurator() = default;
143
144 private:
145 virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore& Core) const override { return DynExp::MakeParams<PVCamConfigurator>(ID, Core); }
146 };
147
148 class PVCam : public Camera
149 {
150 public:
154
155 constexpr static auto Name() noexcept { return "PVCam"; }
156
157 PVCam(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType&& Params);
158 virtual ~PVCam() {}
159
160 virtual std::string GetName() const override { return Name(); }
161
162 virtual bool CanSetExposureTime() const noexcept override { return true; }
163 virtual double GetPixelSizeInMicrons() const noexcept override { return 6.5; }
164
165 virtual void SetCameraMode(size_t ID, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<PVCamTasks::SetCameraMode>(ID, CallbackFunc); }
166 virtual void SetExposureTime(const CameraData::TimeType ExposureTime, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<PVCamTasks::SetExposureTimeTask>(ExposureTime, CallbackFunc); }
167 virtual void CaptureSingle(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<PVCamTasks::CaptureSingleTask>(CallbackFunc); }
168 virtual void StartCapturing(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<PVCamTasks::StartCapturingTask>(CallbackFunc); }
169 virtual void StopCapturing(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<PVCamTasks::StopCapturingTask>(CallbackFunc); }
170
171 private:
172 void ResetImpl(dispatch_tag<Camera>) override final;
174
175 virtual std::unique_ptr<DynExp::InitTaskBase> MakeInitTask() const override { return DynExp::MakeTask<PVCamTasks::InitTask>(); }
176 virtual std::unique_ptr<DynExp::ExitTaskBase> MakeExitTask() const override { return DynExp::MakeTask<PVCamTasks::ExitTask>(); }
177 virtual std::unique_ptr<DynExp::UpdateTaskBase> MakeUpdateTask() const override { return DynExp::MakeTask<PVCamTasks::UpdateTask>(); }
178 };
179}
Defines a meta instrument for an image capturing device.
Defines DynExp's core module as an interface between the UI and DynExp objects.
Implementation of a hardware adapter to control Teledyne Photometrics PVCam hardware....
Configurator class for Camera.
Definition Camera.h:300
Data class for Camera.
Definition Camera.h:76
CapturingStateType
Type indicating whether the camera is currently capturing images.
Definition Camera.h:106
@ Stopped
The camera is not capturing.
std::chrono::milliseconds TimeType
Time type describing the camera's times like its exposure time.
Definition Camera.h:101
Parameter class for Camera.
Definition Camera.h:277
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition Camera.h:39
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition Camera.h:26
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition Camera.h:52
Meta instrument for an image capturing (camera) device.
Definition Camera.h:313
virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core) const override
Override to make derived classes call DynExp::MakeParams with the correct configurator type derived f...
Definition PVCam.h:145
virtual ~PVCamConfigurator()=default
DynExp::LinkedObjectWrapperContainer< DynExpHardware::PVCamHardwareAdapter > HardwareAdapter
Definition PVCam.h:107
virtual CapturingStateType GetCapturingStateChild() const noexcept override
Returns the camera's current capturing state.
Definition PVCam.h:113
CapturingStateType CapturingState
Definition PVCam.h:115
void SetCapturingState(CapturingStateType CapturingState) noexcept
Definition PVCam.h:105
virtual void ResetImpl(dispatch_tag< PVCamData >)
Definition PVCam.h:111
virtual ~PVCamData()=default
size_t NumFailedStatusUpdateAttempts
Definition PVCam.h:116
void ResetImpl(dispatch_tag< CameraData >) override final
Definition PVCam.cpp:174
Param< DynExp::ObjectLink< DynExpHardware::PVCamHardwareAdapter > > HardwareAdapter
Definition PVCam.h:127
virtual void ConfigureParamsImpl(dispatch_tag< PVCamParams >)
Definition PVCam.h:132
virtual ~PVCamParams()=default
PVCamParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Definition PVCam.h:122
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
Definition PVCam.h:125
void ConfigureParamsImpl(dispatch_tag< CameraParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition PVCam.h:131
CaptureSingleTask(CallbackType CallbackFunc) noexcept
Definition PVCam.h:71
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition PVCam.cpp:147
void ExitFuncImpl(dispatch_tag< CameraTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition PVCam.cpp:30
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Definition PVCam.h:33
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Definition PVCam.h:26
void InitFuncImpl(dispatch_tag< CameraTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition PVCam.cpp:8
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition PVCam.cpp:129
SetCameraMode(const size_t ID, CallbackType CallbackFunc) noexcept
Definition PVCam.h:48
SetExposureTimeTask(const CameraData::TimeType ExposureTime, CallbackType CallbackFunc) noexcept
Definition PVCam.h:59
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition PVCam.cpp:138
const CameraData::TimeType ExposureTime
Definition PVCam.h:65
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition PVCam.cpp:156
StartCapturingTask(CallbackType CallbackFunc) noexcept
Definition PVCam.h:80
StopCapturingTask(CallbackType CallbackFunc) noexcept
Definition PVCam.h:89
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition PVCam.cpp:165
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Definition PVCam.h:40
virtual QImage ObtainImage(DynExp::InstrumentInstance &Instance) override
Retrieves the current image from the underlying hardware device, applies image transformations (e....
Definition PVCam.cpp:51
void UpdateFuncImpl(dispatch_tag< CameraTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition PVCam.h:38
virtual bool CanSetExposureTime() const noexcept override
Determines whether the derived camera's exposure time can be set by software.
Definition PVCam.h:162
virtual double GetPixelSizeInMicrons() const noexcept override
Determines the camera's physical pixel size assuming square pixels.
Definition PVCam.h:163
virtual void StopCapturing(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Stops image capturing.
Definition PVCam.h:169
virtual ~PVCam()
Definition PVCam.h:158
virtual std::unique_ptr< DynExp::ExitTaskBase > MakeExitTask() const override
Factory function for an exit task (ExitTaskBase). Override to define the desired deinitialization tas...
Definition PVCam.h:176
virtual void SetCameraMode(size_t ID, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Sets the image capturing modes the camera should work in.
Definition PVCam.h:165
virtual std::unique_ptr< DynExp::UpdateTaskBase > MakeUpdateTask() const override
Factory function for an update task (UpdateTaskBase). Override to define the desired update task in d...
Definition PVCam.h:177
virtual void ResetImpl(dispatch_tag< PVCam >)
Definition PVCam.h:173
virtual void CaptureSingle(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Makes the camera capture a single image.
Definition PVCam.h:167
void ResetImpl(dispatch_tag< Camera >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
Definition PVCam.cpp:187
virtual std::string GetName() const override
Returns the name of this Object type.
Definition PVCam.h:160
static constexpr auto Name() noexcept
Definition PVCam.h:155
virtual void SetExposureTime(const CameraData::TimeType ExposureTime, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Sets the camera's exposure time.
Definition PVCam.h:166
virtual void StartCapturing(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Makes the camera capture images continuously.
Definition PVCam.h:168
virtual std::unique_ptr< DynExp::InitTaskBase > MakeInitTask() const override
Factory function for an init task (InitTaskBase). Override to define the desired initialization task ...
Definition PVCam.h:175
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition DynExpCore.h:127
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to ParamsBase::dispatch_tag.
Definition Instrument.h:146
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Definition Instrument.h:772
This class holds a pointer (LinkedObjectWrapperPointer) to a LinkedObjectWrapper. Intances of this cl...
Definition Object.h:3160
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
Definition Object.h:2302
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Definition Object.h:2303
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
const auto & GetCore() const noexcept
Returns a reference to DynExp's core.
Definition Object.h:1677
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
Definition Object.h:1779
const DynExpCore & Core
Reference to DynExp's core.
Definition Object.h:1780
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition Object.h:349
Base class for all tasks being processed by instruments. The class must not contain public virtual fu...
Definition Instrument.h:892
std::function< void(const TaskBase &, ExceptionContainer &)> CallbackType
Type of a callback function which is invoked when a task has finished, failed or has been aborted....
Definition Instrument.h:939
TaskBase(CallbackType CallbackFunc=nullptr) noexcept
Constructs an instrument task.
Definition Instrument.h:979
const CallbackType CallbackFunc
This callback function is called after the task has finished (either successfully or not) with a refe...
Defines the return type of task functions.
Definition Instrument.h:824
Refer to DynExp::ParamsBase::dispatch_tag.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
constexpr auto HardwareAdapter
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
Definition Object.h:1807
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.