CVB++ 14.0
DataType Class Referencefinal

Data type description for an image plane. More...

#include <cvb/data_type.hpp>

Public Member Functions

template<template< class > class T, class ACTION , class... CTORARGS>
auto CallWithInstanceOf (ACTION action, CTORARGS... args) const -> decltype(action(T< int >{std::forward< CTORARGS >(args)...}))
 Calls action with T instance of native data type this value represents. More...
 
template<class T >
bool Matches () const noexcept
 Gets whether the type T matches this data type. More...
 
int NativeDescriptor () const noexcept
 Native data type descriptor. More...
 
int BitsPerPixel () const noexcept
 Number of actually valid bits per pixel. More...
 
int BytesPerPixel () const noexcept
 Number of bytes occupied by each pixel. More...
 
bool IsFloat () const noexcept
 Gets whether the pixels of the plane have floating point values. More...
 
bool IsSignedInteger () const noexcept
 Gets whether the pixels of the plane have signed integer values. More...
 
bool IsUnsignedInteger () const noexcept
 Gets whether the pixels of the plane have unsigned integer values. More...
 
bool IsSigned () const noexcept
 Gets whether the pixels of the plane have signed values. More...
 
bool HasOverlayBit () const noexcept
 Gets whether bit 0 of the pixels of the plane are being used as an overlay indicator bit. More...
 
bool IsComplexPacked () const noexcept
 Indicates whether or not the plane contains a complex packed image format. More...
 
double MinVal () const noexcept
 Gets the minimum pixel value that fits this data type. More...
 
double MaxVal () const noexcept
 Gets the maximum pixel value that fits this data type. More...
 
PixelDataType NumericType () const noexcept
 Returns the basic numeric type of the pixels. More...
 
double UndefinedVal () const noexcept
 Get the undefined value for this data type. More...
 
bool operator== (const DataType &dataType) const noexcept
 Compares to an other data type. More...
 
bool operator!= (const DataType &dataType) const noexcept
 Compares to an other data type. More...
 

Static Public Member Functions

static DataType FromNativeDescriptor (int dataTypeDescriptor) noexcept
 Construct a data type descriptor from one of the native library's descriptor values. More...
 
static DataType Int8BppUnsigned () noexcept
 Represents 8-bit unsigned integer pixels (bytes). More...
 
static DataType Int8BppSigned () noexcept
 Represents 8-bit signed integer pixels. More...
 
static DataType Int10BppUnsigned () noexcept
 Represents 10-bit unsigned integer pixels. More...
 
static DataType Int12BppUnsigned () noexcept
 Represents 12-bit unsigned integer pixels. More...
 
static DataType Int16BppUnsigned () noexcept
 Represents 16-bit unsigned integer pixels. More...
 
static DataType Int16BppSigned () noexcept
 Represents 16-bit signed integer pixels. More...
 
static DataType Int32BppUnsigned () noexcept
 Represents 32-bit unsigned integer pixels. More...
 
static DataType Int32BppSigned () noexcept
 Represents 32-bit signed integer pixels. More...
 
static DataType Int64BppUnsigned () noexcept
 Represents 64-bit unsigned integer pixels. More...
 
static DataType Int64BppSigned () noexcept
 Represents 64-bit signed integer pixels. More...
 
static DataType Float32Bpp () noexcept
 Represents single precision (32-bit) floating point pixels. More...
 
static DataType Float64Bpp () noexcept
 Represents double precision (64-bit) floating point pixels. More...
 
template<typename T >
static DataType FromNativeType () noexcept
 Construct a data type descriptor from one of the native data type value equivalents. More...
 

Detailed Description

Data type description for an image plane.

Member Function Documentation

◆ BitsPerPixel()

int BitsPerPixel ( ) const
inlinenoexcept

Number of actually valid bits per pixel.

Returns
int Number of bits.
Exceptions
Doesnot throw any exception.

◆ BytesPerPixel()

int BytesPerPixel ( ) const
inlinenoexcept

Number of bytes occupied by each pixel.

Returns
int Number of bytes.
Exceptions
Doesnot throw any exception.

◆ CallWithInstanceOf()

auto CallWithInstanceOf ( ACTION  action,
CTORARGS...  args 
) const -> decltype(action(T<int>{std::forward<CTORARGS>(args)...}))
inline

Calls action with T instance of native data type this value represents.

Template Parameters
TTemplate template that is instantiated with a data type like uint8_t.
ACTIONCallable that accepts one T value as argument.
CTORARGSTypes of arguments passed to the ctor of T.
Parameters
[in]actionCallable accepting exactly one T instance by value.
[in]argsOptional arguments forwarded to the T constructor.
Returns
Return type of action called with T value.
Exceptions
CvbExceptionif there is no compatible native data type; except action throws

◆ Float32Bpp()

static DataType Float32Bpp ( )
inlinestaticnoexcept

Represents single precision (32-bit) floating point pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Float64Bpp()

static DataType Float64Bpp ( )
inlinestaticnoexcept

Represents double precision (64-bit) floating point pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ FromNativeDescriptor()

static DataType FromNativeDescriptor ( int  dataTypeDescriptor)
inlinestaticnoexcept

Construct a data type descriptor from one of the native library's descriptor values.

Parameters
[in]dataTypeDescriptorNative descriptor value.
Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ FromNativeType()

static DataType FromNativeType ( )
inlinestaticnoexcept

Construct a data type descriptor from one of the native data type value equivalents.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

The usage is as follows:

CvbDataType::FromNativeType<std::uint8_t>(); // equivalent to: CvbDataType::Int8BppUnsigned();
CvbDataType::FromNativeType<std::int8_t>(); // equivalent to: CvbDataType::Int8BppSigned();
CvbDataType::FromNativeType<std::uint16_t>(); // equivalent to: CvbDataType::Int16BppUnsigned();
CvbDataType::FromNativeType<std::int16_t>(); // equivalent to: CvbDataType::Int16BppSigned();
CvbDataType::FromNativeType<float>(); // equivalent to: CvbDataType::Float32Bpp();
CvbDataType::FromNativeType<double>(); // equivalent to: CvbDataType::Float64Bpp();

◆ HasOverlayBit()

bool HasOverlayBit ( ) const
inlinenoexcept

Gets whether bit 0 of the pixels of the plane are being used as an overlay indicator bit.

Returns
bool True if the least significant bit is used as overlay indicator, false otherwise.
Exceptions
Doesnot throw any exception.

◆ Int10BppUnsigned()

static DataType Int10BppUnsigned ( )
inlinestaticnoexcept

Represents 10-bit unsigned integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int12BppUnsigned()

static DataType Int12BppUnsigned ( )
inlinestaticnoexcept

Represents 12-bit unsigned integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int16BppSigned()

static DataType Int16BppSigned ( )
inlinestaticnoexcept

Represents 16-bit signed integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int16BppUnsigned()

static DataType Int16BppUnsigned ( )
inlinestaticnoexcept

Represents 16-bit unsigned integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int32BppSigned()

static DataType Int32BppSigned ( )
inlinestaticnoexcept

Represents 32-bit signed integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int32BppUnsigned()

static DataType Int32BppUnsigned ( )
inlinestaticnoexcept

Represents 32-bit unsigned integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int64BppSigned()

static DataType Int64BppSigned ( )
inlinestaticnoexcept

Represents 64-bit signed integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int64BppUnsigned()

static DataType Int64BppUnsigned ( )
inlinestaticnoexcept

Represents 64-bit unsigned integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int8BppSigned()

static DataType Int8BppSigned ( )
inlinestaticnoexcept

Represents 8-bit signed integer pixels.

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ Int8BppUnsigned()

static DataType Int8BppUnsigned ( )
inlinestaticnoexcept

Represents 8-bit unsigned integer pixels (bytes).

Returns
CvbDataType Data type descriptor object.
Exceptions
Doesnot throw any exception.

◆ IsComplexPacked()

bool IsComplexPacked ( ) const
inlinenoexcept

Indicates whether or not the plane contains a complex packed image format.

Returns
bool True if complex and/or packed, false otherwise.
Exceptions
Doesnot throw any exception.

Such a format that makes use of the hermitian symmetries in images resulting from Fourier transformation of a real-valued image.

Note
Image info of this type are usually not usable directly.

◆ IsFloat()

bool IsFloat ( ) const
inlinenoexcept

Gets whether the pixels of the plane have floating point values.

Returns
bool True if pixels have floating point values, false otherwise.
Exceptions
Doesnot throw any exception.

◆ IsSigned()

bool IsSigned ( ) const
inlinenoexcept

Gets whether the pixels of the plane have signed values.

Returns
bool True if pixels have signed values, false otherwise.
Exceptions
Doesnot throw any exception.

◆ IsSignedInteger()

bool IsSignedInteger ( ) const
inlinenoexcept

Gets whether the pixels of the plane have signed integer values.

Returns
bool True if pixels have signed integer values, false otherwise.
Exceptions
Doesnot throw any exception.

◆ IsUnsignedInteger()

bool IsUnsignedInteger ( ) const
inlinenoexcept

Gets whether the pixels of the plane have unsigned integer values.

Returns
bool True if pixels have unsigned integer values, false otherwise.
Exceptions
Doesnot throw any exception.

◆ Matches()

bool Matches ( ) const
inlinenoexcept

Gets whether the type T matches this data type.

T matches this data type if the BytesPerPixel() match its size and if the signed/integer/float traits match.

Template Parameters
TNumeric plain old data type.
Returns
true if T is compatible; false if not.
Exceptions
Doesnot throw any exception.

◆ MaxVal()

double MaxVal ( ) const
inlinenoexcept

Gets the maximum pixel value that fits this data type.

Returns
double Maximum pixel value mapped to double.
Exceptions
Doesnot throw any exception.

◆ MinVal()

double MinVal ( ) const
inlinenoexcept

Gets the minimum pixel value that fits this data type.

Returns
double Minimum pixel value mapped to double.
Exceptions
Doesnot throw any exception.

◆ NativeDescriptor()

int NativeDescriptor ( ) const
inlinenoexcept

Native data type descriptor.

Returns
int Descriptor used by the native library.
Exceptions
Doesnot throw any exception.

◆ NumericType()

PixelDataType NumericType ( ) const
inlinenoexcept

Returns the basic numeric type of the pixels.

Returns
PixelDataType Pixel type.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const DataType dataType) const
inlinenoexcept

Compares to an other data type.

Parameters
[in]dataTypeOther data type.
Returns
bool True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const DataType dataType) const
inlinenoexcept

Compares to an other data type.

Parameters
[in]dataTypeOther data type.
Returns
bool True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ UndefinedVal()

double UndefinedVal ( ) const
inlinenoexcept

Get the undefined value for this data type.

Returns
double For integer values returns the mean from min and max, for floating point values return 0.0.
Exceptions
Doesnot throw any exception.

Pixel value for those pixels whose value cannot be defined correctly. For example in scanning situations, where pixels outside the image are accessed.