Class MainWindow
Class used to manage all UI component interactions as well as displaying the images queried from cameras. More...
#include <mainwindow.h>
Inherits the following classes: QMainWindow
Public Slots
| Type | Name |
|---|---|
| slot void | UpdateRGBImage (const QImage & image) Qt slot that updates the RGB image displayed in the GUI. |
| slot void | UpdateRawImage (const QImage & image) |
| slot void | UpdateSaturationPercentageLCDDisplays (double percentageBelowThreshold, double percentageAboveThreshold) Qt slot that updates the saturation percentage on the LCD displays. |
Public Signals
| Type | Name |
|---|---|
| signal void | ViewerImageProcessingComplete (QImage image) Qt signal that is emitted when reading an processing of the image to display in viewer tab is finished. |
Public Functions
| Type | Name |
|---|---|
| void | DisplayCameraTemperature () const Displays camera temperature on an LCD display. |
| void | DisplayRecordCount () const Displays the number of recorded images in the GUI. |
| void | EnableUi (bool enable) const Enables the UI elements. |
| unsigned | GetBGRNorm () const |
| virtual unsigned | GetBand () const Queries the band number to be displayed. |
| QMap< QString, float > | GetCameraTemperature () const Gets camera temperature. |
| QString | GetLogFilePath (const QString & logFile) const Queries the path where the logfile is stored. |
| bool | GetNormalize () const Queries if normalization should be applied to the displayed images. |
| virtual int | GetSaturationMaxValue () const Retrieves the maximum allowable value for the saturation adjustment. |
| virtual int | GetSaturationMinValue () const Retrieves the minimum saturation value allowed by the saturation spin boxes. |
| Ui::MainWindow * | GetUI () const Provides access to the applications user interface. |
| void | HandleTemperatureTimer (const boost::system::error_code & error) Handle for timer used to schedule camera temperature logging. |
| bool | IsSaturationButtonChecked () const Identifies if the saturation tool button is checked or not. |
| QString | LogMessage (const QString & message, const QString & logFile, bool logTime) const Logs message to log file and returns the timestamp used during logging. |
| MainWindow (QWidget * parent=nullptr, const std::shared_ptr< XiAPIWrapper > & xiAPIWrapper=nullptr) |
|
| void | ScheduleTemperatureThread () Creates schedule for the thread in charge of logging temperature of the camera. |
| void | SetRecordedCount (int count) Sets the number of images recorded. |
| void | SetUpCustomUiComponents () const Configures custom UI elements such as custom icons in buttons, etc. |
| void | StartTemperatureThread () Starts the thread in charge of logging camera temperature. |
| void | StopSnapshotsThread () Stops thread in charge of recording snapshot images. |
| void | StopTemperatureThread () Stops thread in charge of logging camera temperature. |
| void | UpdateFPSLCDDisplay () const Updates the frames per second that are stored to file on the UI. |
| void | UpdateRawViewerImage (const QImage & image) Updates the raw image displayed in the viewer tab. |
| void | ViewerWorkerThreadFunc () Waits for the viewer thread to be running and for new values to be available in the queue. It emits a signal indicating that a new value can be processed. |
| void | WriteLogHeader () const |
| ~MainWindow () override |
Public Static Functions
| Type | Name |
|---|---|
| void | EnableWidgetsInLayout (const QLayout * layout, bool enable) Disables the UI elements. |
| void | UpdateImage (QImage image, const QGraphicsView * view, std::unique_ptr< QGraphicsPixmapItem > & pixmapItem, QGraphicsScene * scene) Takes an image, and scales it to the available width in the QtGraphicsView element before displaying it in the provided scene. |
Protected Attributes
| Type | Name |
|---|---|
| b2nd_array_t * | m_viewerNDArray = nullptrThis is the NDArray structure that holds the connection to the data viewed in the Viewer tab of the application. |
| Ui::MainWindow * | ui Main access point to all Qt components in the user interface. All Qt components in the UI can be accessed through this pointer. |
Protected Functions
| Type | Name |
|---|---|
| void | closeEvent (QCloseEvent * event) override Event handler for the close event of the main window. |
Detailed Description
This class is in charge of initializing the UI components and handle any interactions with the user as well as displaying the images queried from the camera. During initialization of the UI, this class performs the following steps:
- Initialize camera interface and image container.
- Setup native and custom UI components.
- Initialize BLOSC2.
- Populates list of available cameras.
- Established
Qtconnections. - Disables UI components until a camera is selected by the user.
Public Slots Documentation
slot UpdateRGBImage
Qt slot that updates the RGB image displayed in the GUI.
Parameters:
imageQt image containing an 8bit (per channel) RGB image to be displayed.
slot UpdateRawImage
Qt slot that updates the raw image displayed in the GUI.
Parameters:
imageQt image containing an 8bit single channel image to be displayed.
slot UpdateSaturationPercentageLCDDisplays
Qt slot that updates the saturation percentage on the LCD displays.
Parameters:
percentageBelowThresholdPercentage of under-exposed pixels.percentageAboveThresholdPercentage of overexposed pixels.
Public Signals Documentation
signal ViewerImageProcessingComplete
Qt signal that is emitted when reading an processing of the image to display in viewer tab is finished.
Parameters:
imageQt image containing the image to display. This should be a one channel image.
Public Functions Documentation
function DisplayCameraTemperature
Displays camera temperature on an LCD display.
function DisplayRecordCount
Displays the number of recorded images in the GUI.
function EnableUi
Enables the UI elements.
Parameters:
enableindicates if UI is enabled or not.
function GetBGRNorm
Queries the normalization factor to be used.
function GetBand
Queries the band number to be displayed.
function GetCameraTemperature
Gets camera temperature.
Returns:
mapper containing the camera temperature with keys identifying the location on the camera where the temperature was queried from.
function GetLogFilePath
Queries the path where the logfile is stored.
Parameters:
logFilefile name.
Returns:
path to file.
function GetNormalize
Queries if normalization should be applied to the displayed images.
function GetSaturationMaxValue
Retrieves the maximum allowable value for the saturation adjustment.
This function queries and returns the highest saturation value stored by the saturation control component. It is used to determine the upper limit of the saturation adjustment range in the UI.
Returns:
The maximum saturation value supported.
function GetSaturationMinValue
Retrieves the minimum saturation value allowed by the saturation spin boxes.
This method provides the lower boundary of the saturation adjustment range stored by the saturation spin boxes in the UI.
Returns:
The minimum saturation value as an integer.
function GetUI
Provides access to the applications user interface.
Returns:
pointer tot he Ui::MainWindow from which all Qt component in the user interface can be accessed.
function HandleTemperatureTimer
Handle for timer used to schedule camera temperature logging.
Parameters:
errortype of error expected to cancel the timer.
function IsSaturationButtonChecked
Identifies if the saturation tool button is checked or not.
Returns:
true if the saturation button is checked, false otherwise.
function LogMessage
Logs message to log file and returns the timestamp used during logging.
QString MainWindow::LogMessage (
const QString & message,
const QString & logFile,
bool logTime
) const
Parameters:
messagemessage to be logged.logFilefile name where the message should be logged.logTimewhether time should be logged too or not.
function MainWindow
explicit MainWindow::MainWindow (
QWidget * parent=nullptr,
const std::shared_ptr< XiAPIWrapper > & xiAPIWrapper=nullptr
)
function ScheduleTemperatureThread
Creates schedule for the thread in charge of logging temperature of the camera.
function SetRecordedCount
Sets the number of images recorded.
Parameters:
countnumber of recorded images.
function SetUpCustomUiComponents
Configures custom UI elements such as custom icons in buttons, etc.
function StartTemperatureThread
Starts the thread in charge of logging camera temperature.
function StopSnapshotsThread
Stops thread in charge of recording snapshot images.
function StopTemperatureThread
Stops thread in charge of logging camera temperature.
function UpdateFPSLCDDisplay
Updates the frames per second that are stored to file on the UI.
function UpdateRawViewerImage
Updates the raw image displayed in the viewer tab.
Parameters:
imageQt image to display.
function ViewerWorkerThreadFunc
Waits for the viewer thread to be running and for new values to be available in the queue. It emits a signal indicating that a new value can be processed.
function WriteLogHeader
Writes general information as header of the log file.
function ~MainWindow
Public Static Functions Documentation
function EnableWidgetsInLayout
Disables the UI elements.
Parameters:
layoutlayout where elements will be enabled or disabled.enableindicates if elements should ne enabled or disabled.
function UpdateImage
Takes an image, and scales it to the available width in the QtGraphicsView element before displaying it in the provided scene.
static void MainWindow::UpdateImage (
QImage image,
const QGraphicsView * view,
std::unique_ptr< QGraphicsPixmapItem > & pixmapItem,
QGraphicsScene * scene
)
Parameters:
imageQt image to be displayed.viewthe graphics view element where image will be displayed.pixmapItempixmap item where the image is to be placed.scenethe scene that will contain the pixmap.
Protected Attributes Documentation
variable m_viewerNDArray
This is the NDArray structure that holds the connection to the data viewed in the Viewer tab of the application.
variable ui
Main access point to all Qt components in the user interface. All Qt components in the UI can be accessed through this pointer.
Protected Functions Documentation
function closeEvent
Event handler for the close event of the main window.
This method is called when the user attempts to close the main window either by clicking the close button or using the system shortcut. It is responsible for handling any necessary cleanup or actions before the application closes. If a recording is running when the close event is triggered, the recordings are first stopped to ensure no loss of data happens.
Parameters:
eventA pointer to the event object representing the close event.
The documentation for this class was generated from the following file src/mainwindow.h