169 QImage
GetImageCopy(
const QRect& RegionOfInterest = QRect())
const;
217 void ResetImpl(dispatch_tag<InstrumentDataBase>)
override final;
328 constexpr
static auto Name() noexcept {
return "Camera"; }
329 constexpr
static auto Category() noexcept {
return "Image Capturing"; }
342 virtual std::chrono::milliseconds
GetTaskQueueDelay()
const override {
return std::chrono::milliseconds(16); }
374 virtual
void SetCameraMode(
size_t ID,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const;
430 template <typename T>
434 float PixelF = ImageTransformation.ContrastFactor * Pixel + ImageTransformation.BrightnessFactor * std::numeric_limits<T>::max();
437 PixelF = std::min(
static_cast<float>(std::numeric_limits<T>::max()), std::round(PixelF));
438 PixelF = std::max(
static_cast<float>(std::numeric_limits<T>::lowest()), PixelF);
440 return static_cast<T
>(PixelF);
Implementation of DynExp instrument objects.
Configurator class for Camera.
CameraConfigurator()=default
virtual ~CameraConfigurator()=0
CapturingStateType
Type indicating whether the camera is currently capturing images.
@ CapturingSingle
The camera is caturing a single image and will stop afterwards.
@ CapturingContinuously
The camera is capturing one image after the other.
@ Stopped
The camera is not capturing.
void SetIntensityHistogram(Util::ImageHistogramType &&IntensityHistogram) noexcept
Setter for IntensityHistogram. Moves from argument.
std::chrono::milliseconds TimeType
Time type describing the camera's times like its exposure time.
unsigned int ImageDimensionType
Type describing image dimensions such as width and height.
QImage GetImageCopy(const QRect &RegionOfInterest=QRect()) const
Copying getter for CurrentImage. This function is more expensive than GetImage().
float BrightnessFactor
Factor to enhance the image brightness (between -1 and 1).
QImage GetImage() const
Moving getter for CurrentImage.
auto GetIntensityHistogram() const noexcept
Getter for IntensityHistogram.
auto GetImageWidth() const noexcept
Getter for ImageWidth.
auto GetRGBHistogram() const noexcept
Getter for RGBHistogram.
bool IsEnabled
Determines whether the image transformation is to be applied (enabled).
const auto & GetImageTransformation() const noexcept
Getter for ImageTransformation.
Util::ImageRGBHistogramType RGBHistogram
Color (RGB) histograms belonging to CurrentImage. The histograms are computed if ComputeHistogram is ...
TimeType GetMaxExposureTime() const
Getter for MaxExposureTime.
ImageDimensionType ImageWidth
Width of the images the camera captures.
void SetImage(QImage &&Other)
Setter for CurrentImage.
bool IsCapturingSingle() const noexcept
Determines whether the camera is currently capturing a single image.
std::vector< std::string > CameraModesType
List type containing strings of modes the camera can operate in.
auto GetCurrentFPS() const noexcept
Getter for CurrentFPS.
TimeType MinExposureTime
Minimal exposure time the camera supports.
void SetImageTransformation(const ImageTransformationType &Transformation) const noexcept
Setter for ImageTransformation. Adjustable by modules.
void ResetImpl(dispatch_tag< InstrumentDataBase >) override final
float CurrentFPS
Current frames per second when the camera is capturing images continuously.
auto GetCapturingState() const noexcept
Returns the camera's current capturing state.
virtual ~CameraData()=default
void SetExposureTime(TimeType CurrentExposureTime)
Setter for CurrentExposureTime.
ImageTransformationType ImageTransformation
Image transformation to be applied to each captured image. Logical const-ness: allow modules to commu...
bool IsImageAvailbale() const noexcept
Determines whether an image is currently available.
void SetMinExposureTime(TimeType MinExposureTime)
Setter for MinExposureTime.
void SetMaxExposureTime(TimeType MaxExposureTime)
Setter for MaxExposureTime.
ComputeHistogramType
Type indicating whether histograms should be computed for newly captured images.
@ IntensityAndRGBHistogram
Combination of IntensityHistogram and RGBHistogram.
@ RGBHistogram
Compute separate histograms for each of the image's color channels (RGB).
@ NoHistogram
Histogram computation is disabled.
@ IntensityHistogram
Compute an intensity histogram by converting the image to grayscale.
virtual CapturingStateType GetCapturingStateChild() const noexcept=0
Returns the camera's current capturing state.
auto GetComputeHistogram() const noexcept
Getter for ComputeHistogram.
void SetImageWidth(ImageDimensionType ImageWidth) noexcept
Setter for ImageWidth.
auto GetImageHeight() const noexcept
Getter for ImageHeight.
CameraModesType CameraModes
Image capturing modes the camera can work in.
TimeType MaxExposureTime
Maximal exposure time the camera supports.
bool IsCapturing() const noexcept
Determines whether the camera is currently capturing an image.
Util::ImageHistogramType IntensityHistogram
Intensity (grayscale) histogram belonging to CurrentImage. The histogram is computed if ComputeHistog...
QImage CurrentImage
Current image captured by the camera. Logical const-ness: allow const member function GetImage() to m...
TimeType CurrentExposureTime
Current exposure time of the camera.
void SetRGBHistogram(Util::ImageRGBHistogramType &&RGBHistogram) noexcept
Setter for RGBHistogram. Moves from argument.
void SetComputeHistogram(ComputeHistogramType ComputeHistogram) const noexcept
Setter for ComputeHistogram. Adjustable by modules.
void ClearImage() const
Resets CurrentImage to a default-constructed empty image and IntensityHistogram as well as RGBHistogr...
float ContrastFactor
Factor to enhance the image contrast. Valid interval is (0, Inf).
virtual void ResetImpl(dispatch_tag< CameraData >)
void SetCameraModes(CameraModesType CameraModes)
Setter for CameraModes.
bool IsCapturingContinuously() const noexcept
Determines whether the camera is currently capturing images consecutively.
TimeType GetMinExposureTime() const
Getter for MinExposureTime.
ComputeHistogramType ComputeHistogram
Determines the histogram types to be computed for each captured image. Logical const-ness: allow modu...
void SetImageHeight(ImageDimensionType ImageHeight) noexcept
Setter for ImageHeight.
TimeType GetExposureTime() const
Getter for CurrentExposureTime.
void SetCurrentFPS(float CurrentFPS) noexcept
Setter for CurrentFPS.
auto GetCameraModes() const
Getter for CameraModes.
ImageDimensionType ImageHeight
Height of the images the camera captures.
Parameter class for Camera.
CameraParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a Camera instance.
virtual ~CameraParams()=0
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
virtual void ConfigureParamsImpl(dispatch_tag< CameraParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
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...
void ConfigureParamsImpl(dispatch_tag< InstrumentParamsBase >) override final
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
void ExitFuncImpl(dispatch_tag< ExitTaskBase >, DynExp::InstrumentInstance &Instance) override final
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< InitTaskBase >, DynExp::InstrumentInstance &Instance) override final
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
void UpdateFuncImpl(dispatch_tag< UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
virtual QImage ObtainImage(DynExp::InstrumentInstance &Instance)=0
Retrieves the current image from the underlying hardware device, applies image transformations (e....
Meta instrument for an image capturing (camera) device.
virtual void SetExposureTime(const CameraData::TimeType ExposureTime, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the camera's exposure time.
void ResetImpl(dispatch_tag< InstrumentBase >) override final
virtual double GetPixelSizeInMicrons() const noexcept=0
Determines the camera's physical pixel size assuming square pixels.
virtual std::string GetCategory() const override
Returns the category of this Object type.
virtual void StopCapturing(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Stops image capturing.
virtual bool CanSetExposureTime() const noexcept
Determines whether the derived camera's exposure time can be set by software.
virtual void StopCapturingSync() const
Synchronized version of StopCapturing(), which blocks until a stop capturing task issued by an overri...
virtual std::string GetName() const override
Returns the name of this Object type.
virtual void StartCapturing(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Makes the camera capture images continuously.
virtual void SetExposureTimeSync(const CameraData::TimeType ExposureTime) const
Synchronized version of SetExposureTime(), which blocks until a set exposure time task issued by an o...
virtual void CaptureSingle(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Makes the camera capture a single image.
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
virtual void SetCameraMode(size_t ID, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the image capturing modes the camera should work in.
constexpr static auto Category() noexcept
Every derived class has to redefine this function.
Camera(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
constexpr static auto Name() noexcept
Every derived class has to redefine this function.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
InstrumentBase(const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
Constructs an instrument instance.
Configurator class for InstrumentBase.
Data structure to contain data which is synchronized in between different threads....
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Parameter class for InstrumentBase.
InstrumentParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a InstrumentBase instance.
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
T TransformPixel(T Pixel, const CameraData::ImageTransformationType &ImageTransformation)
Applies an image transformation to a single pixel.
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
DynExp's Util namespace contains commonly used functions and templates as well as extensions to Qt an...
std::array< unsigned long long, 256 > ImageHistogramType
Alias which represents a histogram as a std::array with 256 numeric bins. The lowest (highest) index ...
std::tuple< ImageHistogramType, ImageHistogramType, ImageHistogramType > ImageRGBHistogramType
Alias which represents a RGB histogram as a std::tuple of three ImageHistogramType elements....
Accumulates include statements to provide a precompiled header.