Skip to content

Class ImageContainer

ClassList > ImageContainer

Container for images queried from each camera. More...

  • #include <imageContainer.h>

Inherits the following classes: QObject

Public Attributes

Type Name
bool m_PollImage
std::shared_ptr< XiAPIWrapper > m_apiWrapper
std::unique_ptr< FileImage > m_imageFile

Public Signals

Type Name
signal void NewImage

Public Functions

Type Name
void CloseFile ()
XI_IMG GetCurrentImage ()
ImageContainer ()
void Initialize (const std::shared_ptr< XiAPIWrapper > & apiWrapper)
void InitializeFile (const char * filePath)
void PollImage (const HANDLE * cameraHandle, int pollingRate)
Polls for a new image from the camera at a given polling rate.
void StartPolling ()
void StopPolling ()
~ImageContainer () override

Detailed Description

This class handles the polling of images from the camera and emits a Qt signal when a new image is available. If an error occurs when acquiring an image from the camera, e.g. connection error, the file associated with the acquisition is closed, metadata is appended, and throws an exception.

The file associated with the images can be initialized with ImageContainer::InitializeFile, and it can be closed using ImageContainer::CloseFile. Closing the file automatically appends the corresponding metadata to the file.

Public Attributes Documentation

variable m_PollImage

bool ImageContainer::m_PollImage;

Indicates if images should be polled or not


variable m_apiWrapper

std::shared_ptr<XiAPIWrapper> ImageContainer::m_apiWrapper;

Wrapper to xiAPI, useful for mocking the aPI during testing


variable m_imageFile

std::unique_ptr<FileImage> ImageContainer::m_imageFile;

Pointer to image file object in charge of writing data to file.


Public Signals Documentation

signal NewImage

void ImageContainer::NewImage;

Qt signal used to indicate that a new image has arrived to the container


Public Functions Documentation

function CloseFile

void ImageContainer::CloseFile () 

Manages proper closing of file in case in case it has been initialized.


function GetCurrentImage

XI_IMG ImageContainer::GetCurrentImage () 

Queries current imag ein container

Returns:

current image in container


function ImageContainer

ImageContainer::ImageContainer () 

Constructor of image container. The memory of the current image in container is set here with memset


function Initialize

void ImageContainer::Initialize (
    const std::shared_ptr< XiAPIWrapper > & apiWrapper
) 

Initializes the container by setting the API for communication with the cameras

Parameters:

  • apiWrapper

function InitializeFile

void ImageContainer::InitializeFile (
    const char * filePath
) 

It initializes the file object that will be used to store the data.

Parameters:

  • filePath file path (without extension) where data will be stored

function PollImage

Polls for a new image from the camera at a given polling rate.

void ImageContainer::PollImage (
    const HANDLE * cameraHandle,
    int pollingRate
) 

This function continuously polls for a new image from the camera using the specified camera handle. It uses the given polling rate to determine how frequently to poll for new images. Once a new image is obtained, it emits a signal to notify that a new image is available.

A lock guard is used to avoid overwriting the current container image when other processes are using it.

Parameters:

  • cameraHandle The handle to the camera device.
  • pollingRate The polling rate in milliseconds.

function StartPolling

void ImageContainer::StartPolling () 

Starts image polling


function StopPolling

void ImageContainer::StopPolling () 

Stops image polling


function ~ImageContainer

ImageContainer::~ImageContainer () override

Destructor of image container



The documentation for this class was generated from the following file src/imageContainer.h