Skip to content

File util.h

FileList > src > util.h

Go to the source code of this file

  • #include <b2nd.h>
  • #include <xiApi.h>
  • #include <QColor>
  • #include <QMap>
  • #include <QString>
  • #include <boost/log/trivial.hpp>
  • #include <msgpack.hpp>
  • #include <opencv2/highgui/highgui.hpp>
  • #include <string>

Classes

Type Name
struct CommandLineArguments
Structure used to store command line arguments parsed by the user.
class FileImage
Image container responsible of writing images to a file, including metadata.

Public Attributes

Type Name
CommandLineArguments g_commandLineArguments
Contains the CLI arguments that can be parsed through the terminal by the user. This is initialized at start of the program, before the Qt application is initialized.

Public Functions

Type Name
void AppendBLOSCVLMetadata (b2nd_array_t * src, const char * key, msgpack::sbuffer & newData)
Appends variable length metadata to a BLOSC n-dimensional array.
std::string ColorFilterToString (XI_COLOR_FILTER_ARRAY colorFilterArray)
Converts the XIMEA color filter array identifier to a string representation.
cv::Mat CreateLut (const QColor & saturationColor, const QColor & darkColor, int minValue, int maxValue)
Created a look up table (LUT) that can be used to define the colors of pixels in an image that are over-saturated or under-exposed.
int GetBLOSCVLMetadataLength (const b2nd_array_t * src, const char * key)
Unpacks the metadata in array and computes the number of elements corresponding to the specified key.
QString GetTimeStamp ()
Generates a timestamp with the format yyyyMMdd_hh-mm-ss-zzz .
void PackAndAppendMetadata (b2nd_array_t * src, const char * key, const std::vector< T > & metadata)
Packs and appends the metadata associated with a BLOSC NDarray.
void WaitMilliseconds (int milliseconds)
waits a certain amount of milliseconds on a boost thread.
void XIIMGtoMat (const XI_IMG & xi_img, cv::Mat & mat_img)
Helper function which wraps a ximea image in a cv::Mat.

Macros

Type Name
define HandleBLOSCResult (res, place) /* multi line expression */
Handles the result after BLOSC2 operations when return code is != 0.
define HandleResult (res, place) /* multi line expression */
Handles the result from the XiAPI, shows an error message and throws a runtime error if not XI_OK.

Public Attributes Documentation

variable g_commandLineArguments

Contains the CLI arguments that can be parsed through the terminal by the user. This is initialized at start of the program, before the Qt application is initialized.

CommandLineArguments g_commandLineArguments;


Public Functions Documentation

function AppendBLOSCVLMetadata

Appends variable length metadata to a BLOSC n-dimensional array.

void AppendBLOSCVLMetadata (
    b2nd_array_t * src,
    const char * key,
    msgpack::sbuffer & newData
) 

Parameters:

  • src BLOSC n-dimensional array where the metadata will be added
  • key string to be used as a key for naming the medata data variable
  • newData data package with Message Pack < https://msgpack.org/ >_.

function ColorFilterToString

Converts the XIMEA color filter array identifier to a string representation.

std::string ColorFilterToString (
    XI_COLOR_FILTER_ARRAY colorFilterArray
) 

Parameters:

  • colorFilterArray XIMEA color filter array representation

Returns:

string representing the color filter array


function CreateLut

Created a look up table (LUT) that can be used to define the colors of pixels in an image that are over-saturated or under-exposed.

cv::Mat CreateLut (
    const QColor & saturationColor,
    const QColor & darkColor,
    int minValue,
    int maxValue
) 

Parameters:

  • saturationColor color of pixels that are over-saturated.
  • darkColor color of pixels that are under-exposed.
  • minValue saturation minimum value.
  • maxValue saturation maximum value.

Returns:

matrix with LUT.


function GetBLOSCVLMetadataLength

Unpacks the metadata in array and computes the number of elements corresponding to the specified key.

int GetBLOSCVLMetadataLength (
    const b2nd_array_t * src,
    const char * key
) 

Parameters:

  • src BLOSC ND-Array from which the metadata should be analyzed.
  • key Identifier of the metadata layer from which the number of elements is desired.

Returns:

number of elements in metadata layer or negative value if an error occurred.


function GetTimeStamp

Generates a timestamp with the format yyyyMMdd_hh-mm-ss-zzz .

QString GetTimeStamp () 


function PackAndAppendMetadata

Packs and appends the metadata associated with a BLOSC NDarray.

template<typename T>
void PackAndAppendMetadata (
    b2nd_array_t * src,
    const char * key,
    const std::vector< T > & metadata
) 

Template parameters:

  • T data type of the metadata

Parameters:

  • src pointer to BLOSC array where the metadata will be appended
  • key string that will be used to identify the metadata inside the array
  • metadata content to be stored in the metadata

function WaitMilliseconds

waits a certain amount of milliseconds on a boost thread.

void WaitMilliseconds (
    int milliseconds
) 

Parameters:

  • milliseconds amount of time to WaitMilliseconds

function XIIMGtoMat

Helper function which wraps a ximea image in a cv::Mat.

void XIIMGtoMat (
    const XI_IMG & xi_img,
    cv::Mat & mat_img
) 

Parameters:

  • xi_img input ximea image
  • mat_img output cv::Mat image

Macro Definition Documentation

define HandleBLOSCResult

Handles the result after BLOSC2 operations when return code is != 0.

#define HandleBLOSCResult (
    res,
    place
) `/* multi line expression */`

Exception:

  • runtime

define HandleResult

Handles the result from the XiAPI, shows an error message and throws a runtime error if not XI_OK.

#define HandleResult (
    res,
    place
) `/* multi line expression */`

Exception:

  • runtime


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