DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpInstr::CameraData Class Referenceabstract

Data class for Camera. More...

+ Inheritance diagram for DynExpInstr::CameraData:

Classes

struct  ImageTransformationType
 Type describing an image transformation. More...
 

Public Types

enum class  CapturingStateType { Stopped , CapturingSingle , CapturingContinuously }
 Type indicating whether the camera is currently capturing images. More...
 
enum class  ComputeHistogramType { NoHistogram , IntensityHistogram , RGBHistogram , IntensityAndRGBHistogram }
 Type indicating whether histograms should be computed for newly captured images. More...
 
using ImageDimensionType = unsigned int
 Type describing image dimensions such as width and height. More...
 
using CameraModesType = std::vector< std::string >
 List type containing strings of modes the camera can operate in. More...
 
using TimeType = std::chrono::milliseconds
 Time type describing the camera's times like its exposure time. More...
 
- Public Types inherited from DynExp::InstrumentDataBase
using TaskQueueType = std::list< std::unique_ptr< TaskBase > >
 Type of an instrument task queue owning the tasks within. More...
 
using TaskQueueIteratorType = TaskQueueType::const_iterator
 Const iterator type to elements of TaskQueueType. More...
 

Public Member Functions

 CameraData ()=default
 
virtual ~CameraData ()=default
 
auto GetImageWidth () const noexcept
 Getter for ImageWidth. More...
 
void SetImageWidth (ImageDimensionType ImageWidth) noexcept
 Setter for ImageWidth. More...
 
auto GetImageHeight () const noexcept
 Getter for ImageHeight. More...
 
void SetImageHeight (ImageDimensionType ImageHeight) noexcept
 Setter for ImageHeight. More...
 
auto GetCameraModes () const
 Getter for CameraModes. More...
 
void SetCameraModes (CameraModesType CameraModes)
 Setter for CameraModes. More...
 
TimeType GetMinExposureTime () const
 Getter for MinExposureTime. More...
 
TimeType GetMaxExposureTime () const
 Getter for MaxExposureTime. More...
 
TimeType GetExposureTime () const
 Getter for CurrentExposureTime. More...
 
void SetMinExposureTime (TimeType MinExposureTime)
 Setter for MinExposureTime. More...
 
void SetMaxExposureTime (TimeType MaxExposureTime)
 Setter for MaxExposureTime. More...
 
void SetExposureTime (TimeType CurrentExposureTime)
 Setter for CurrentExposureTime. More...
 
auto GetCurrentFPS () const noexcept
 Getter for CurrentFPS. More...
 
void SetCurrentFPS (float CurrentFPS) noexcept
 Setter for CurrentFPS. More...
 
auto GetComputeHistogram () const noexcept
 Getter for ComputeHistogram. More...
 
void SetComputeHistogram (ComputeHistogramType ComputeHistogram) const noexcept
 Setter for ComputeHistogram. Adjustable by modules. More...
 
auto GetIntensityHistogram () const noexcept
 Getter for IntensityHistogram. More...
 
void SetIntensityHistogram (Util::ImageHistogramType &&IntensityHistogram) noexcept
 Setter for IntensityHistogram. Moves from argument. More...
 
auto GetRGBHistogram () const noexcept
 Getter for RGBHistogram. More...
 
void SetRGBHistogram (Util::ImageRGBHistogramType &&RGBHistogram) noexcept
 Setter for RGBHistogram. Moves from argument. More...
 
const auto & GetImageTransformation () const noexcept
 Getter for ImageTransformation. More...
 
void SetImageTransformation (const ImageTransformationType &Transformation) const noexcept
 Setter for ImageTransformation. Adjustable by modules. More...
 
QImage GetImage () const
 Moving getter for CurrentImage. More...
 
QImage GetImageCopy (const QRect &RegionOfInterest=QRect()) const
 Copying getter for CurrentImage. This function is more expensive than GetImage(). More...
 
bool IsImageAvailbale () const noexcept
 Determines whether an image is currently available. More...
 
void SetImage (QImage &&Other)
 Setter for CurrentImage. More...
 
void ClearImage () const
 Resets CurrentImage to a default-constructed empty image and IntensityHistogram as well as RGBHistogram to default-constructed empty histograms. More...
 
auto GetCapturingState () const noexcept
 Returns the camera's current capturing state. More...
 
bool IsCapturing () const noexcept
 Determines whether the camera is currently capturing an image. More...
 
bool IsCapturingSingle () const noexcept
 Determines whether the camera is currently capturing a single image. More...
 
bool IsCapturingContinuously () const noexcept
 Determines whether the camera is currently capturing images consecutively. More...
 
- Public Member Functions inherited from DynExp::InstrumentDataBase
 InstrumentDataBase ()
 
virtual ~InstrumentDataBase ()
 
auto GetLastUpdateTime () const
 Getter for LastUpdate. More...
 
auto GetException () const noexcept
 Getter for InstrumentDataBase::InstrumentException. More...
 
void EnqueueTask (std::unique_ptr< TaskBase > &&Task)
 Enqueues a task at the back of an instrument's task queue and notifies the instrument about the new task. More...
 
void EnqueuePriorityTask (std::unique_ptr< TaskBase > &&Task)
 Enqueues a task at the front of an instrument's task queue and notifies the instrument about the new task. More...
 
std::unique_ptr< TaskBasePopTaskFront ()
 Removes a task from the front of an instrument's task queue. More...
 
std::unique_ptr< TaskBasePopTaskBack ()
 Removes a task from the back of an instrument's task queue. More...
 
auto GetTaskFront () noexcept
 Getter for first enqueued task. More...
 
auto GetTaskBack () noexcept
 Getter for last enqueued task. More...
 
size_t GetNumEnqueuedTasks () const noexcept
 Getter for the instrument task queue's length. More...
 
std::unique_ptr< TaskBasePopFinishedTask ()
 Removes a task from the front of an instrument's list of finished tasks. More...
 
size_t GetNumFinishedTasks () const noexcept
 Getter for the length of the instrument's list of finished tasks. More...
 
bool IsQueueClosed () const noexcept
 Determines whether the instrument task queue is closed. More...
 
- Public Member Functions inherited from Util::INonCopyable
 INonCopyable (const INonCopyable &)=delete
 
INonCopyableoperator= (const INonCopyable &)=delete
 

Private Member Functions

void ResetImpl (dispatch_tag< InstrumentDataBase >) override final
 
virtual void ResetImpl (dispatch_tag< CameraData >)
 
Override

Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every derived class gets called - starting from InstrumentDataBase, descending the inheritance hierarchy. Override in order to reset derived classes.

Override by derived classes.

virtual CapturingStateType GetCapturingStateChild () const noexcept=0
 Returns the camera's current capturing state. More...
 

Private Attributes

ImageDimensionType ImageWidth = 0
 Width of the images the camera captures. More...
 
ImageDimensionType ImageHeight = 0
 Height of the images the camera captures. More...
 
CameraModesType CameraModes
 Image capturing modes the camera can work in. More...
 
TimeType MinExposureTime
 Minimal exposure time the camera supports. More...
 
TimeType MaxExposureTime
 Maximal exposure time the camera supports. More...
 
TimeType CurrentExposureTime
 Current exposure time of the camera. More...
 
float CurrentFPS = 0.f
 Current frames per second when the camera is capturing images continuously. More...
 
ComputeHistogramType ComputeHistogram = ComputeHistogramType::NoHistogram
 Determines the histogram types to be computed for each captured image. Logical const-ness: allow modules to communicate to this instrument by adjusting ComputeHistogram. More...
 
Util::ImageHistogramType IntensityHistogram = {}
 Intensity (grayscale) histogram belonging to CurrentImage. The histogram is computed if ComputeHistogram is set accordingly. Logical const-ness: allow const member function ClearImage() to clear the histogram. More...
 
Util::ImageRGBHistogramType RGBHistogram = {}
 Color (RGB) histograms belonging to CurrentImage. The histograms are computed if ComputeHistogram is set accordingly. Logical const-ness: allow const member function ClearImage() to clear the histograms. More...
 
ImageTransformationType ImageTransformation
 Image transformation to be applied to each captured image. Logical const-ness: allow modules to communicate to this instrument by adjusting ImageTransformation. More...
 
QImage CurrentImage
 Current image captured by the camera. Logical const-ness: allow const member function GetImage() to move from CurrentImage and ClearImage() to clear it. More...
 

Additional Inherited Members

- Public Attributes inherited from DynExp::InstrumentDataBase
InstrumentBaseOnlyType InstrumentBaseOnly
 Allow exclusive access to some of InstrumentDataBase's private methods to InstrumentBase. More...
 
InstrumenThreadOnlyType InstrumentThreadOnly
 Allow exclusive access to some of InstrumentDataBase's private methods to the instrument thread InstrumentThreadMain(). More...
 
- Protected Member Functions inherited from Util::ISynchronizedPointerLockable
 ISynchronizedPointerLockable ()
 
 ~ISynchronizedPointerLockable ()
 Object should never be destroyed before completely unlocked. More...
 
- Protected Member Functions inherited from Util::INonCopyable
constexpr INonCopyable ()=default
 
 ~INonCopyable ()=default
 

Detailed Description

Data class for Camera.

Definition at line 75 of file Camera.h.


Class Documentation

◆ DynExpInstr::CameraData::ImageTransformationType

struct DynExpInstr::CameraData::ImageTransformationType

Type describing an image transformation.

Definition at line 81 of file Camera.h.

Class Members
float BrightnessFactor Factor to enhance the image brightness (between -1 and 1).
float ContrastFactor Factor to enhance the image contrast. Valid interval is (0, Inf).
bool IsEnabled Determines whether the image transformation is to be applied (enabled).

Member Typedef Documentation

◆ CameraModesType

using DynExpInstr::CameraData::CameraModesType = std::vector<std::string>

List type containing strings of modes the camera can operate in.

Definition at line 100 of file Camera.h.

◆ ImageDimensionType

Type describing image dimensions such as width and height.

Definition at line 99 of file Camera.h.

◆ TimeType

using DynExpInstr::CameraData::TimeType = std::chrono::milliseconds

Time type describing the camera's times like its exposure time.

Definition at line 101 of file Camera.h.

Member Enumeration Documentation

◆ CapturingStateType

Type indicating whether the camera is currently capturing images.

Enumerator
Stopped 

The camera is not capturing.

CapturingSingle 

The camera is caturing a single image and will stop afterwards.

CapturingContinuously 

The camera is capturing one image after the other.

Definition at line 106 of file Camera.h.

◆ ComputeHistogramType

Type indicating whether histograms should be computed for newly captured images.

Enumerator
NoHistogram 

Histogram computation is disabled.

IntensityHistogram 

Compute an intensity histogram by converting the image to grayscale.

RGBHistogram 

Compute separate histograms for each of the image's color channels (RGB).

IntensityAndRGBHistogram 

Combination of IntensityHistogram and RGBHistogram.

Definition at line 115 of file Camera.h.

Constructor & Destructor Documentation

◆ CameraData()

DynExpInstr::CameraData::CameraData ( )
default

◆ ~CameraData()

virtual DynExpInstr::CameraData::~CameraData ( )
virtualdefault

Member Function Documentation

◆ ClearImage()

void DynExpInstr::CameraData::ClearImage ( ) const

Resets CurrentImage to a default-constructed empty image and IntensityHistogram as well as RGBHistogram to default-constructed empty histograms.

Definition at line 77 of file Camera.cpp.

◆ GetCameraModes()

auto DynExpInstr::CameraData::GetCameraModes ( ) const
inline

Getter for CameraModes.

Definition at line 130 of file Camera.h.

◆ GetCapturingState()

auto DynExpInstr::CameraData::GetCapturingState ( ) const
inlinenoexcept

Returns the camera's current capturing state.

Returns
Capturing state of type CameraData::CapturingStateType

Definition at line 193 of file Camera.h.

◆ GetCapturingStateChild()

virtual CapturingStateType DynExpInstr::CameraData::GetCapturingStateChild ( ) const
privatepure virtualnoexcept

Returns the camera's current capturing state.

Returns
Capturing state of type CameraData::CapturingStateType

Implemented in DynExpInstr::PVCamData, and DynExpInstr::DummyCameraData.

◆ GetComputeHistogram()

auto DynExpInstr::CameraData::GetComputeHistogram ( ) const
inlinenoexcept

Getter for ComputeHistogram.

Definition at line 143 of file Camera.h.

◆ GetCurrentFPS()

auto DynExpInstr::CameraData::GetCurrentFPS ( ) const
inlinenoexcept

Getter for CurrentFPS.

Definition at line 140 of file Camera.h.

◆ GetExposureTime()

TimeType DynExpInstr::CameraData::GetExposureTime ( ) const
inline

Getter for CurrentExposureTime.

Definition at line 135 of file Camera.h.

◆ GetImage()

QImage DynExpInstr::CameraData::GetImage ( ) const

Moving getter for CurrentImage.

Returns
Returns an image move-constructed from CurrentImage. Subsequent calls to GetImage() or GetImageCopy() will fail until a new image has been captured.
Exceptions
Util::EmptyExceptionis thrown if CurrentImage is empty.

Definition at line 55 of file Camera.cpp.

◆ GetImageCopy()

QImage DynExpInstr::CameraData::GetImageCopy ( const QRect &  RegionOfInterest = QRect()) const

Copying getter for CurrentImage. This function is more expensive than GetImage().

Parameters
RegionOfInterestRegion of interest to copy and return. Refer to Qt documentation of QImage::copy().
Returns
Returns an image copy-constructed from CurrentImage.
Exceptions
Util::EmptyExceptionis thrown if CurrentImage is empty.

Definition at line 64 of file Camera.cpp.

◆ GetImageHeight()

auto DynExpInstr::CameraData::GetImageHeight ( ) const
inlinenoexcept

Getter for ImageHeight.

Definition at line 127 of file Camera.h.

◆ GetImageTransformation()

const auto& DynExpInstr::CameraData::GetImageTransformation ( ) const
inlinenoexcept

Getter for ImageTransformation.

Definition at line 150 of file Camera.h.

◆ GetImageWidth()

auto DynExpInstr::CameraData::GetImageWidth ( ) const
inlinenoexcept

Getter for ImageWidth.

Definition at line 125 of file Camera.h.

◆ GetIntensityHistogram()

auto DynExpInstr::CameraData::GetIntensityHistogram ( ) const
inlinenoexcept

Getter for IntensityHistogram.

Definition at line 145 of file Camera.h.

◆ GetMaxExposureTime()

TimeType DynExpInstr::CameraData::GetMaxExposureTime ( ) const
inline

Getter for MaxExposureTime.

Definition at line 134 of file Camera.h.

◆ GetMinExposureTime()

TimeType DynExpInstr::CameraData::GetMinExposureTime ( ) const
inline

Getter for MinExposureTime.

Definition at line 133 of file Camera.h.

◆ GetRGBHistogram()

auto DynExpInstr::CameraData::GetRGBHistogram ( ) const
inlinenoexcept

Getter for RGBHistogram.

Definition at line 147 of file Camera.h.

◆ IsCapturing()

bool DynExpInstr::CameraData::IsCapturing ( ) const
inlinenoexcept

Determines whether the camera is currently capturing an image.

Returns
Returns true if GetCapturingState() returns anything else than CapturingStateType::Stopped, false otherwise.

Definition at line 200 of file Camera.h.

◆ IsCapturingContinuously()

bool DynExpInstr::CameraData::IsCapturingContinuously ( ) const
inlinenoexcept

Determines whether the camera is currently capturing images consecutively.

Returns
Returns true if GetCapturingState() returns CapturingStateType::CapturingContinuously, false otherwise.

Definition at line 214 of file Camera.h.

◆ IsCapturingSingle()

bool DynExpInstr::CameraData::IsCapturingSingle ( ) const
inlinenoexcept

Determines whether the camera is currently capturing a single image.

Returns
Returns true if GetCapturingState() returns CapturingStateType::CapturingSingle, false otherwise.

Definition at line 207 of file Camera.h.

◆ IsImageAvailbale()

bool DynExpInstr::CameraData::IsImageAvailbale ( ) const
inlinenoexcept

Determines whether an image is currently available.

Returns
Returns true if CurrentImage is not empty (not null), false otherwise.

Definition at line 175 of file Camera.h.

◆ ResetImpl() [1/2]

virtual void DynExpInstr::CameraData::ResetImpl ( dispatch_tag< CameraData )
inlineprivatevirtual

Reimplemented in DynExpInstr::PVCamData, and DynExpInstr::DummyCameraData.

Definition at line 218 of file Camera.h.

◆ ResetImpl() [2/2]

void DynExpInstr::CameraData::ResetImpl ( dispatch_tag< InstrumentDataBase )
finaloverrideprivate

Definition at line 85 of file Camera.cpp.

◆ SetCameraModes()

void DynExpInstr::CameraData::SetCameraModes ( CameraModesType  CameraModes)
inline

Setter for CameraModes.

Definition at line 131 of file Camera.h.

◆ SetComputeHistogram()

void DynExpInstr::CameraData::SetComputeHistogram ( ComputeHistogramType  ComputeHistogram) const
inlinenoexcept

Setter for ComputeHistogram. Adjustable by modules.

Definition at line 144 of file Camera.h.

◆ SetCurrentFPS()

void DynExpInstr::CameraData::SetCurrentFPS ( float  CurrentFPS)
inlinenoexcept

Setter for CurrentFPS.

Definition at line 141 of file Camera.h.

◆ SetExposureTime()

void DynExpInstr::CameraData::SetExposureTime ( TimeType  CurrentExposureTime)
inline

Setter for CurrentExposureTime.

Definition at line 138 of file Camera.h.

◆ SetImage()

void DynExpInstr::CameraData::SetImage ( QImage &&  Other)

Setter for CurrentImage.

Parameters
OtherImage to set CurrentImage to by moving from Other.

Definition at line 72 of file Camera.cpp.

◆ SetImageHeight()

void DynExpInstr::CameraData::SetImageHeight ( ImageDimensionType  ImageHeight)
inlinenoexcept

Setter for ImageHeight.

Definition at line 128 of file Camera.h.

◆ SetImageTransformation()

void DynExpInstr::CameraData::SetImageTransformation ( const ImageTransformationType Transformation) const
inlinenoexcept

Setter for ImageTransformation. Adjustable by modules.

Definition at line 151 of file Camera.h.

◆ SetImageWidth()

void DynExpInstr::CameraData::SetImageWidth ( ImageDimensionType  ImageWidth)
inlinenoexcept

Setter for ImageWidth.

Definition at line 126 of file Camera.h.

◆ SetIntensityHistogram()

void DynExpInstr::CameraData::SetIntensityHistogram ( Util::ImageHistogramType &&  IntensityHistogram)
inlinenoexcept

Setter for IntensityHistogram. Moves from argument.

Definition at line 146 of file Camera.h.

◆ SetMaxExposureTime()

void DynExpInstr::CameraData::SetMaxExposureTime ( TimeType  MaxExposureTime)
inline

Setter for MaxExposureTime.

Definition at line 137 of file Camera.h.

◆ SetMinExposureTime()

void DynExpInstr::CameraData::SetMinExposureTime ( TimeType  MinExposureTime)
inline

Setter for MinExposureTime.

Definition at line 136 of file Camera.h.

◆ SetRGBHistogram()

void DynExpInstr::CameraData::SetRGBHistogram ( Util::ImageRGBHistogramType &&  RGBHistogram)
inlinenoexcept

Setter for RGBHistogram. Moves from argument.

Definition at line 148 of file Camera.h.

Member Data Documentation

◆ CameraModes

CameraModesType DynExpInstr::CameraData::CameraModes
private

Image capturing modes the camera can work in.

Definition at line 230 of file Camera.h.

◆ ComputeHistogram

ComputeHistogramType DynExpInstr::CameraData::ComputeHistogram = ComputeHistogramType::NoHistogram
mutableprivate

Determines the histogram types to be computed for each captured image. Logical const-ness: allow modules to communicate to this instrument by adjusting ComputeHistogram.

Definition at line 242 of file Camera.h.

◆ CurrentExposureTime

TimeType DynExpInstr::CameraData::CurrentExposureTime
private

Current exposure time of the camera.

Definition at line 234 of file Camera.h.

◆ CurrentFPS

float DynExpInstr::CameraData::CurrentFPS = 0.f
private

Current frames per second when the camera is capturing images continuously.

Definition at line 235 of file Camera.h.

◆ CurrentImage

QImage DynExpInstr::CameraData::CurrentImage
mutableprivate

Current image captured by the camera. Logical const-ness: allow const member function GetImage() to move from CurrentImage and ClearImage() to clear it.

Definition at line 270 of file Camera.h.

◆ ImageHeight

ImageDimensionType DynExpInstr::CameraData::ImageHeight = 0
private

Height of the images the camera captures.

Definition at line 228 of file Camera.h.

◆ ImageTransformation

ImageTransformationType DynExpInstr::CameraData::ImageTransformation
mutableprivate

Image transformation to be applied to each captured image. Logical const-ness: allow modules to communicate to this instrument by adjusting ImageTransformation.

Definition at line 263 of file Camera.h.

◆ ImageWidth

ImageDimensionType DynExpInstr::CameraData::ImageWidth = 0
private

Width of the images the camera captures.

Definition at line 227 of file Camera.h.

◆ IntensityHistogram

Util::ImageHistogramType DynExpInstr::CameraData::IntensityHistogram = {}
mutableprivate

Intensity (grayscale) histogram belonging to CurrentImage. The histogram is computed if ComputeHistogram is set accordingly. Logical const-ness: allow const member function ClearImage() to clear the histogram.

Definition at line 249 of file Camera.h.

◆ MaxExposureTime

TimeType DynExpInstr::CameraData::MaxExposureTime
private

Maximal exposure time the camera supports.

Definition at line 233 of file Camera.h.

◆ MinExposureTime

TimeType DynExpInstr::CameraData::MinExposureTime
private

Minimal exposure time the camera supports.

Definition at line 232 of file Camera.h.

◆ RGBHistogram

Util::ImageRGBHistogramType DynExpInstr::CameraData::RGBHistogram = {}
mutableprivate

Color (RGB) histograms belonging to CurrentImage. The histograms are computed if ComputeHistogram is set accordingly. Logical const-ness: allow const member function ClearImage() to clear the histograms.

Definition at line 256 of file Camera.h.


The documentation for this class was generated from the following files: