DataObject - ReferenceΒΆ

class ito::DataObject

dataObject contains a n-dimensional matrix

The n-dimensional matrix can have different element types. Recently the following types are supported: int8, uint8, int16, uint16, int32, uint32, float32, float64 (=> double), complex64 (2x float32), complex128 (2x float64)

In order to handle huge matrices, the data object can divide one matrix into subparts in memory. Each subpart (called matrix-plane) is two-dimensional and covers data of the last two dimensions. Each of these matrix-planes is of type cv::Mat_<type> and can be used with every operator given by the openCV-framework (version 2.3.1 or higher).

We assume to have a n-dimensional matrix A, where each dimension has its size s_i, hence A=[s_1, s_2, ..., s_(n-2), s_(n-1), s_n]

Hence, in total there are s_1 * s_2 * ... * s_(n-2) different matrix-planes, which are all accessible by the member m_data, which is a std::vector of the general type int*. This type has to be casted to the specific cv::Mat_<...> when one matrix-plane has to be accessed. Sometimes it is also possible to simply cast to cv::Mat.

In order to make the data object compatible to continuously organized data structures, like numpy-arrays, it is also possible to have all matrix-planes in one data-block in memory. Then the continuous-flag will be set and the whole data block can be accessed by taking the pointer given by m_data[0]. Nevertheless, the indicated data structure with the two-dimensional sub-matrix-planes is still existing, hence, the pointer to each matrix-planes points to the entry point of its matrix-planes lying withing the huge data block.

The data organization is equal to the one of open-cv, hence, two-dimensional matrices are stored row-by-row (C-style)...

The real size of each dimension is stored in the vector m_osize. Since it is possible to set a n-dimensional region of interest (ROI) to each matrix, the virtual dimensions, which will be delivered if the user asks for the matrix size, are stored in the member vector m_size.

Concept to handle templated and non-templated methods —————————————————–

According to openCV, the class dataObject is not templated, because there are some structures in the entire itom-framework which does not support any templating concept, like the plugin-handling or communication with external dll-functions. Additionally the signal-slot-design of the Qt-framework does not accept templated parameters beside some standard-objects. Therefore the element-data-type is set by the integer-member m_type. The transformation between the real data type and the integer number is coded several times within the whole framework and can be accessed by the enumeration tDataType in typeDefs.h. Since templating has got many advantages concerning low-level calculation, we adapted the transformation-process which is used by openCV:

1. define a templated helper-method in the following form:

template<typename _Tp> returnType ‘MethodName’Func(Parameters1)

2. define the following two lines of code: typedef returnType (*t’MethodName’Func)(Parameters1); MAKEFUNCLIST(‘MethodName’Func);

3. define the method, accessed for example as public-method of dataObject RetVal DataObject::’PublicMethodName’(Parameters2) { ... fList’MethodName’Func[getType()](Parameters1); ... return ... }

— By the macro MAKEFUNCLIST a list fList’MethodName’Func is generated with each entry being a function pointer to the specific templated version of ‘MethodName’Func. The specific method is accessed by using getType() of dataObject. Hence it is important to keep the element-data-types and their order consistent for the whole itom-project.

Public Functions

size_t seekMat(const size_t matNum, const size_t numMats)

returns the index vector-index of m_data which corresponds to the given zero-based two-dimensional matrix-index

Since there might be a difference between the “real” matrix size in memory and the virtual size which is set by subslicing a matrix and hence setting any ROI, this method transforms a desired matrix-plane index to the real index in memory of the data-vector m_data

Return
real vector-index for the desired matrix-plane or 0 if matNum >= numMats.
Parameters
  • matNum -

    zero-based matrix-plane-index, considering the virtual matrix size (ROI), 0<=matNum<calcNumMats

  • numMats -

    total number of matrix-planes, lying within the ROI

size_t seekMat(const size_t matNum)

returns the index vector-index of m_data which corresponds to the given zero-based two-dimensional matrix-index

Since there might be a difference between the “real” matrix size in memory and the virtual size which is set by subslicing a matrix and hence setting any ROI, this method transforms a desired matrix-plane index to the real index in memory of the data-vector m_data

Return
real vector-index for the desired matrix-plane
See

seekMat

calcNumMats

Parameters
  • matNum -

    zero-based matrix-plane considering the virtual matrix size (ROI), 0<=matNum<calcNumMats

size_t calcNumMats(void)

calculates numbers of single opencv matrices which are part of the ROI which has previously been set.

Return
0 if empty range or empty matrix, 1 if two dimensional, else product of sizes of all dimensions besides the last two ones.

double getValueOffset()

< Function return the offset of the values stored within the dataOject

Function return the scaling of values stored within the dataOject

double getValueScale()

Function return the unit description for the values stoerd within the dataOject.

const std::string getValueUnit()

Function return the description for the values stored within the dataOject, if tagspace does not exist, NULL is returned.

std::string getValueDescription()

Function return the axis-offset for the existing axis specified by axisNum. If axisNum is out of dimension range it returns NULL.

double getAxisOffset(const int axisNum)

Function returns the axis-description for the exist axis specified by axisNum. If axisNum is out of dimension range it returns NULL.

double getAxisScale(const int axisNum)

Function returns the axis-unit-description for the exist axis specified by axisNum. If axisNum is out of dimension range it returns NULL.

const std::string getAxisUnit(const int axisNum, bool & validOperation)

Function returns the axis-description for the exist specified by axisNum. If axisNum is out of dimension range it returns NULL.

const std::string getAxisDescription(const int axisNum, bool & validOperation)

DataObjectTagType getTag(const std::string key, bool & validOperation)

bool getTagByIndex(const int tagNumber, std::string & key, DataObjectTagType & value)

Function returns the string-value for ‘key’ identified by int tagNumber. If key in the TagMap do not exist NULL is returned.

std::string getTagKey(const int tagNumber, bool & validOperation)

Function returns the number of elements in the Tags-Maps.

int getTagListSize()

int setValueUnit(const std::string & unit)

< Function to set the string-value of the value unit, return 1 if values does not exist

Function to set the string-value of the value description, return 1 if values does not exist

int setValueDescription(const std::string & description)

int setAxisOffset(const unsigned int axisNum, const double offset)

< Function to set the offset of the specified axis, return 1 if axis does not exist

int setAxisScale(const unsigned int axisNum, const double scale)

< Function to set the scale of the specified axis, return 1 if axis does not exist or scale is 0.0.

int setAxisUnit(const unsigned int axisNum, const std::string & unit)

< Function to set the unit (string value) of the specified axis, return 1 if axis does not exist

int setAxisDescription(const unsigned int axisNum, const std::string & description)

< Function to set the description (string value) of the specified axis, return 1 if axis does not exist

int setTag(const std::string & key, const DataObjectTagType & value)

< Function to set the string value of the specified tag, if the tag do not exist, it will be added automatically, return 1 if tagspace does not exist

bool existTag(const std::string & key)

< Function to check whether tag exist or not

bool deleteTag(const std::string & key)

< Function deletes specified tag. If tag do not exist, return value is 1 else returnvalue is 0

bool deleteAllTags()

int addToProtocol(const std::string & value)

< Function adds value to the protocol-tag. If this object is an ROI, the ROI-coordinates are added. If string do not end with an , is added.

double getPhysToPix(const unsigned int dim, const double phys, bool & isInsideImage)

Function returns the not rounded pixel index of a physical coordinate Function returns the not rounded pixel index of a physical coordinate (Unit-Coordinate = ( px-Coordinate - Offset)* Scale). If the pixel is outside of the image, the isInsideImage-flag is set to false else it is set to true. To avoid memory access-error, the returnvalue is clipped within the range of the image ([0...imagesize-1])

Return
(double)( pix / AxisScale + AxisOffset) & [0..imagesize-1]
Parameters
  • dim -

    Axis-dimension for which the physical coordinate is calculated

  • pix -

    Pixel-index as double

  • isInsideImage -

    flag which is set to true if coordinate is within range of the image.

int getPhysToPix2D(const double physY, double & tPxY, bool & isInsideImageY, const double physX, double & tPxX, bool & isInsideImageX)

Function returns the not rounded pixel index of a physical coordinate.

double getPixToPhys(const unsigned int dim, const double pix, bool & isInsideImage)

Function returns the physical coordinate of a pixel Function returns the physical coordinate of a pixel index (Unit-Coordinate = ( px-Coordinate - Offset)* Scale). If the pixel is outside of the image, the isInsideImage-flag is set to false else it is set to true.

Return
(double)( pix - AxisOffset)* AxisScale)
Parameters
  • dim -

    Axis-dimension for which the physical coordinate is calculated

  • pix -

    Pixel-index as double

  • isInsideImage -

    flag which is set to true if coordinate is within range of the image.

RetVal setXYRotationalMatrix(double r11, double r12, double r13, double r21, double r22, double r23, double r31, double r32, double r33)

Function to access (set) the rotiational matrix by each element.

Return
ito::retOk || ito::retError
Parameters
  • r11 -

    Upper left element

  • r12 -

    Upper middle element

  • r13 -

    Upper rigth element

  • r21 -

    Middle left element

  • r22 -

    Middle middle element

  • r23 -

    Middle rigth element

  • r31 -

    Lower left element

  • r32 -

    Lower middle element

  • r33 -

    Lower rigth element

RetVal getXYRotationalMatrix(double & r11, double & r12, double & r13, double & r21, double & r22, double & r23, double & r31, double & r32, double & r33)

Function to access (get) the rotiational matrix by each element.

Return
ito::retOk || ito::retError
Parameters
  • r11 -

    Upper left element

  • r12 -

    Upper middle element

  • r13 -

    Upper rigth element

  • r21 -

    Middle left element

  • r22 -

    Middle middle element

  • r23 -

    Middle rigth element

  • r31 -

    Lower left element

  • r32 -

    Lower middle element

  • r33 -

    Lower rigth element

RetVal copyTagMapTo(DataObject & rhs)

Deep copies the tagmap with all entries to rhs object

this function makes a deepcopy of the tags map to rhs object from this object.

Return
retOk
See
DataObjectTags
Parameters
  • &rhs -

    is the matrix where the map is copied to. The old map of ths object is cleared first

RetVal copyAxisTagsTo(DataObject & rhs)

Deep copies the axistags to rhs object

this function makes a deepcopy of the axis and value metadata from this object to rhs object. It copies

Return
retOk
See
DataObjectTags
Parameters
  • &rhs -

    is the matrix where the map is copied from. The old map of this object is cleared first

int getDims(void)

< returns the number of dimensions returns the element data type in form of its type-number

int getType(void)

returns if the data in the first n-2 dimensions is stored within one entire block in memory (true), else (false)

char getContinuous(void)

returns if the data object is owner of the data, hence, the data will be deleted by this data object, if nobody else is using the data any more

char getOwnData(void)

size_t getTotal()

gets total number of elements within the data object’s ROI

Return
number of elements
See
getDims, getSize

size_t getOriginalTotal()

gets total number of elements of the whole data object

Return
number of elements
See
getDims, getSize

void lockRead()

locks this dataObject (all header information) and the underlying data block for a read operation

Remark
During the copy-constructor, operator=, eye, zero and ones method, the readWriteLock for the data block will be set to writeLock if any of the participating dataObjects are in writeLock mode. Then the number of readers will be decremented first. The lock of the dataObject, hence the lock for all header information, which are not shared, remains at its level.
See
ReadWriteLock

void lockWrite()

locks this dataObject (all header information) and the underlying data block for a write operation

See
ReadWriteLock

void unlock()

unlocks any lock. If lock is writeLock, lock is set to idle, if lock is readLock, then the number of readers is decremented and lock is freed if no more readers are available

See
ReadWriteLock

RetVal copyTo(DataObject & rhs, unsigned char regionOnly = 0)

high-level, non-templated method to deeply copy the data of this matrix to another matrix rhs

deeply copies the data of this data object to the given rhs-dataObject, whose existing data will be deleted first.

Return
retOk
See
CopyToFunc
Parameters
  • &rhs -

    is the matrix where the data is copied to. The old data of rhs is deleted first

  • regionOnlyif -

    true, only the data of the ROI in lhs is copied, hence, the org-size of rhs corresponds to the ROI-size of lhs, else the whole data block is copied and the ROI of rhs is set to the ROI of lhs

RetVal convertTo(DataObject & rhs, const int type, const double alpha = 1, const double beta = 0)

high-level, non-templated matrix conversion

Every element of the source matrix is converted to a new, given type. Additionally a floating-point scaling and offset parameter is possible.

Return
retOk
See
fListConvertToFunc
Parameters
  • &rhs -

    is the destination data object, whose memory is firstly deleted, then newly allocated

  • type -

    is the type-number of the destination element

  • alpha -

    scaling factor (default: 1.0)

  • beta -

    offset value (default: 0.0)

Exceptions
  • cv::Exception -

    if cast failed, e.g. if cast not possible or types unknown

RetVal deepCopyPartial(DataObject & rhs)

high-level, non-templated method. Deeply copies data of this data object which is within its ROI to the ROI of rhs.

copies the values of each element from this data object to the ROI of the given rhs-dataObject. The rhs-dataObject must be allocated yet and its ROI must be the same size than this ROI

Return
retOk
See
DeepCopyPartialFunc
Parameters
  • &rhs -

    is the right-handed data object, where data is copied to.

Exceptions
  • cv::Exception(CV_StsAssert) -

    if sizes or type of both matrices are not equal

int ** get_mdata(void)

returns pointer to vector of cv::_Mat-matrices

Return
pointer to vector of matrices
Remark
the returned type of std::vector is int*, you should cast it to the appropriate type (e.g. cv::_Mat<int8>)

int ** get_mdata(void)

constant version of get_mdata

See
get_mdata

MSize getSize(void)

returns the size-member. m_size fits to the physical organization of data in memory.

Return
size-member of type MSize

const MSize getSize(void)

returns the size-member. This member does not consider the transpose flag, hence, m_size fits to the physical organization of data in memory.

Return
size-member of type MSize

size_t getSize(int index)

gets the size of the given dimension (this is the size within the ROI)

Return
size or -1 if index is out of boundaries
Parameters
  • index -

    is the specific zero-based dimension-index whose size is requested

size_t getOriginalSize(int index)

gets the original size of the given dimension (this is the size without considering any ROI)

Return
size or -1 if index is out of boundaries
Parameters
  • index -

    is the specific zero-based dimension-index whose size is requested

DObjIterator begin()

returns 0, this is the index of the first element in valid DataObject range.

DObjIterator end()

returns index of last-element in DataObject range incremented by one. (equal to number of elements in total range)

DObjConstIterator constBegin()

DObjConstIterator constEnd()

DataObject(void)

constructor for empty data object

no data will be allocated, the number of elements and dimensions is set to zero

DataObject(const size_t size, const int type)

constructor for one-dimensional data object. The data is newly allocated and arbitrarily filled.

In fact, by this constructor a two-dimensional matrix with dimension 1 x size will be created. the owndata-flag is set to true, the continuously-flag, too (since only one matrix-plane will be created)

See
create, tDataType
Parameters
  • size -

    is the number of elements

  • type -

    is the data-type of each element (use type of enumeration tDataType)

DataObject(const size_t sizeY, const size_t sizeX, const int type)

constructor for two-dimensional data object. The data is newly allocated and arbitrarily filled.

the owndata-flag is set to true, the continuously-flag, too (since only one matrix-plane will be created)

See
create, tDataType
Parameters
  • sizeY -

    is the number of rows in each matrix-plane

  • sizeX -

    is the number of columns in each matrix-plane

  • type -

    is the data-type of each element (use type of enumeration tDataType)

DataObject(const size_t sizeZ, const size_t sizeY, const size_t sizeX, const int type, const unsigned char continuous = 0)

constructor for three-dimensional data object. The data is newly allocated and arbitrarily filled.

the owndata-flag is set to true

See
create, tDataType
Parameters
  • sizeZ -

    is the number of images in the z-direction

  • sizeY -

    is the number of rows in each matrix-plane

  • sizeX -

    is the number of columns in each matrix-plane

  • type -

    is the data-type of each element (use type of enumeration tDataType)

  • continuous -

    indicates whether all matrix-planes should continuously lie in memory (1) or not (0) (default: 0)

DataObject(const size_t sizeZ, const size_t sizeY, const size_t sizeX, const int type, const uchar * continuousDataPtr, const size_t * steps = NULL)

constructor for 3-dimensional data object which uses the data given by the continuousDataPtr.

In case of the continuousDataPtr, the owndata-flag is set to false, hence this dataObj will not delete the data. Additionally the continuous-flag is set to true.

See
create, tDataType
Parameters
  • sizeZ -

    is the number of images in the z-direction

  • sizeY -

    is the number of rows in each matrix-plane

  • sizeX -

    is the number of columns in each matrix-plane

  • type -

    is the data-type of each element (use type of enumeration tDataType)

  • *continuousDataPtr -

    points to the first element of a continuous data block of the specific data type

  • *steps -

    may be NULL, if the data in continuousDataPtr should be taken continuously, hence the ROI is the whole matrix, else this is a vector with three elements, where each elements indicates the number of bytes one has to move in order to get from one element to the next one in the same dimension. Hence, the last element in this vector is equal to the size of one single element (in bytes)

DataObject(const unsigned char dimensions, const size_t * sizes, const int type, const unsigned char continuous = 0)

constructor for data object with given dimension. The data is newly allocated and arbitrarily filled.

the owndata-flag is set to true

See
create, tDataType
Parameters
  • dimensions -

    indicates the total number of dimensions

  • *sizes -

    is a vector of size ‘dimensions’, where each element gives the size (not osize) of the specific dimension

  • type -

    is the data-type of each element (use type of enumeration tDataType)

  • continuous -

    indicates whether all matrix-planes should continuously lie in memory (1) or not (0) (default: 0)

DataObject(const unsigned char dimensions, const size_t * sizes, const int type, const uchar * continuousDataPtr, const size_t * steps = NULL)

constructor for data object which uses the data given by the continuousDataPtr.

In case of the continuousDataPtr, the owndata-flag is set to false, hence this dataObj will not delete the data. Additionally the continuous-flag is set to true.

See
create, ito::tDataType
Parameters
  • dimensions -

    indicates the total number of dimensions

  • *sizes -

    is a vector of size ‘dimensions’, where each element gives the size (not osize) of the specific dimension

  • type -

    is the data-type of each element (use type of enumeration tDataType)

  • *continuousDataPtr -

    points to the first element of a continuous data block of the specific data type

  • *steps -

    may be NULL, if the data in continuousDataPtr should be taken continuously, hence the ROI is the whole matrix, else this is a vector of size ‘dimensions’, where each elements indicates the number of bytes one has to move in order to get from one element to the next one in the same dimension. Hence, the last element in this vector is equal to the size of one single element (in bytes)

DataObject(const unsigned char dimensions, const size_t * sizes, const int type, const cv::Mat * planes, const unsigned int nrOfPlanes)

DataObject(const DataObject & copyConstr)

copy constructor for data object

copy constructor

creates a data object with respect to the given data object. The header information is completely copied, while the data is a shallow copy. The lock of the new data object is unlocked while the lock for the common data block is taken from the current lock status of the given data object.

Parameters
  • &copyConstr -

    is the data object, which will be copied

~DataObject(void)

destructor

reference pointer of data is decremented and if <0, data will be deleted if owndata-flag is true. Additionally the allocated memory for header information will be deleted, too.

See
freeData

DataObject & operator=(const cv::Mat & rhs)

assign-operator which creates a two-dimensional data object as a shallow copy of a two dimensional cv::Mat object.

shallow-copy means, that the header information of this data-object is physically created at the hard disk, while the data is shared with the original cv::Mat.

Return
this data object
See
create
Parameters
  • &rhs -

    is the cv::Mat where the shallow copy is taken from. At first, the existing data of this object is freed.

Exceptions
  • cv::Exception -

    if rhs is not two-dimensional or data type has no compatible data type of dataObject.

DataObject & operator=(const DataObject & rhs)

assign-operator which makes a shallow-copy of the rhs data object and stores it in this data object

shallow-copy means, that the header information of the rhs data-object is physically copied to this-dataObject while the data is shared, hence, only its reference counter is incremented

Return
this data object
See
CopyMatFunc
Parameters
  • &rhs -

    is the data object where the shallow copy is taken from. At first, the existing data of this object is freed.

Exceptions
  • cv::Exception -

    if lock state of both objects is not equal. Please make sure, that both lock states are equal

DataObject & operator=(const int8 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const uint8 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const int16 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const uint16 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const int32 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const uint32 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const float32 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const float64 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const complex64 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator=(const complex128 value)

Every data element in this data object is set to the given value.

sets all elements of the data object to the given value. Value is cast to the data object’s type

Return
modified data object
See
AssignScalarValue
Parameters
  • value -

    is the scalar assignment value

DataObject & operator+=(const DataObject & rhs)

high-level, non-templated arithmetic operator for element-wise addition of values of given data object to this data object

Return
this data object
See
AddFunc
Parameters
  • &rhs -

    is the data object whose elements will be added to this data object

Exceptions
  • cv::Exception -

    if both data objects don’t have the same size or type

DataObject & operator+=(const float64 value)

DataObject operator+(const DataObject & rhs)

high-level, non-templated arithmetic operator for element-wise addition of values of two given data objects

Return
new resulting data object
See
AddFunc
Parameters
  • &rhs -

    is the data object whose elements will be added to this data object

Exceptions
  • cv::Exception -

    if both data objects don’t have the same size or type

DataObject operator+(const float64 value)

DataObject & operator-=(const DataObject & rhs)

high-level, non-templated arithmetic operator for element-wise subtraction of values of given data object from values of this data object

Return
this data object
See
SubFunc
Parameters
  • &rhs -

    is the data object whose elements will be subtracted from this data object

Exceptions
  • cv::Exception -

    if both data objects don’t have the same size or type

DataObject & operator-=(const float64 value)

DataObject operator-(const DataObject & rhs)

high-level, non-templated arithmetic operator for element-wise subtraction of values of given data object from values of this data object

Return
new resulting data object
See
SubFunc
Parameters
  • &rhs -

    is the data object whose elements will be subtracted from this data object

Exceptions
  • cv::Exception -

    if both data objects don’t have the same size or type

DataObject operator-(const float64 value)

DataObject & operator*=(const DataObject & rhs)

brief description

DataObject & operator*=(const float64 factor)

high-level method which multiplies every element in this data object by a given floating-point factor

See
OpScalarMulFunc
Parameters
  • factor -

DataObject operator*(const DataObject & rhs)

brief description

DataObject operator*(const float64 factor)

high-level method which multiplies every element in this data object by a given floating-point factor. The result matrix is returned as a new matrix.

See
operator *, OpScalarMulFunc
Parameters
  • factor -

DataObject operator<(DataObject & rhs)

compare operator, compares for “lower than”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator>(DataObject & rhs)

compare operator, compares for “bigger than”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator<=(DataObject & rhs)

compare operator, compares for “lower or equal than”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator>=(DataObject & rhs)

compare operator, compares for “bigger or equal than”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator==(DataObject & rhs)

compare operator, compares for “equal to”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator!=(DataObject & rhs)

compare operator, compares for “unequal to”

Return
compare matrix of type uint8, which contains 0 or 1, depending on the result of the element-wise comparison
See
CmpFunc
Parameters
  • &rhs -

    is the data object with which this data object should element-wisely be compared

Exceptions
  • cv::Exception -

    if both data objects doesn’t have the same size or type

DataObject operator<<(const unsigned int shiftbit)

high-level operator, which shifts the elements of this data objects by a given number of bits to the left and returns the new data object

Return
new data object with shifted values
See
operator <<=, ShiftLFunc
Parameters
  • shiftbit -

    defines the number of bits to shift

DataObject & operator<<=(const unsigned int shiftbit)

high-level operator, which shifts the elements of this data objects by a given number of bits to the left

Return
reference to this data object
See
ShiftLFunc
Parameters
  • shiftbit -

    defines the number of bits to shift

DataObject operator>>(const unsigned int shiftbit)

high-level operator, which shifts the elements of this data objects by a given number of bits to the right and returns the new data object

Return
new data object with shifted values
See
operator >>=, ShiftRFunc
Parameters
  • shiftbit -

    defines the number of bits to shift

DataObject & operator>>=(const unsigned int shiftbit)

high-level operator, which shifts the elements of this data objects by a given number of bits to the right

Return
reference to this data object
See
ShiftRFunc
Parameters
  • shiftbit -

    defines the number of bits to shift

DataObject operator&(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise and” between this data object and a given data object

the result is returned as a newly allocated data object.

Return
new data object, where the result of the operation is stored
See
operator &=, BitAndFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

DataObject & operator&=(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise and” between this data object and a given data object

Return
reference to this data object, where the result of the operation is stored
See
BitAndFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

DataObject operator|(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise or” between this data object and a given data object

the result is returned as a newly allocated data object.

Return
new data object, where the result of the operation is stored
See
operator |=, BitOrFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

DataObject & operator|=(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise or” between this data object and a given data object

Return
reference to this data object, where the result of the operation is stored
See
BitOrFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

DataObject operator^(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise or” between this data object and a given data object

the result is returned as a newly allocated data object.

Return
new data object, where the result of the operation is stored
See
operator ^=, BitXorFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

DataObject & operator^=(const DataObject & rhs)

high-level operator, which executes the element-wise operation “bitwise xor” between this data object and a given data object

Return
reference to this data object, where the result of the operation is stored
See
BitXorFunc
Parameters
  • &rhs -

    is the matrix which is used for the operator

Exceptions
  • cv::Exception -

    if data type is not supported or both data objects differs either in their size or data type

RetVal zeros(const int type)

allocates a zero-value matrix of size 1x1 with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • type -

    is the desired type-number

RetVal zeros(const size_t size, const int type)

allocates a zero-value matrix of size 1 x size with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • size -

    is the desired length of the vector

  • type -

    is the desired type-number

RetVal zeros(const size_t sizeY, const size_t sizeX, const int type)

allocates a zero-value matrix of size sizeY x sizeX with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

RetVal zeros(const size_t sizeZ, const size_t sizeY, const size_t sizeX, const int type, const unsigned char continuous = 0)

allocates a zero-value, 3D- matrix of size sizeZ x sizeY x sizeX with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeZ -

    are the number of matrix-planes

  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

  • continuous -

    indicates wether the data should be in one continuous block (true) or not (false)

RetVal zeros(const unsigned char dimensions, const size_t * sizes, const int type, const unsigned char continuous = 0)

high-level, non-templated base function for allocation of new matrix whose elements are all set to zero

Return
retOk
See
ZerosFunc
Parameters
  • dimensions -

    indicates the number of dimensions

  • *sizes -

    is a vector with the same length than dimensions. Every element indicates the size of the specific dimension

  • type -

    is the desired data-element-type

  • continuous -

    indicates wether the data should be in one continuous block (true) or not (false)

RetVal ones(const int type)

allocates a one-value matrix of size 1x1 with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • type -

    is the desired type-number

RetVal ones(const size_t size, const int type)

allocates a one-value matrix of size 1 x size with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • size -

    is the desired length of the vector

  • type -

    is the desired type-number

RetVal ones(const size_t sizeY, const size_t sizeX, const int type)

allocates a one-value matrix of size sizeY x sizeX with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

RetVal ones(const size_t sizeZ, const size_t sizeY, const size_t sizeX, const int type, const unsigned char continuous = 0)

allocates a one-valued, 3D- matrix of size sizeZ x sizeY x sizeX with the given type

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeZ -

    are the number of matrix-planes

  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

  • unsigned -

    char continuous indicates wether the data should be in one continuous block (true) or not (false)

RetVal ones(const unsigned char dimensions, const size_t * sizes, const int type, const unsigned char continuous = 0)

high-level, non-templated base function for allocation of new matrix whose elements are all set to one

Return
retOk
See
OnesFunc
Parameters
  • dimensions -

    indicates the number of dimensions

  • *sizes -

    is a vector with the same length than dimensions. Every element indicates the size of the specific dimension

  • type -

    is the desired data-element-type

  • continuous -

    indicates wether the data should be in one continuous block (true) or not (false)

RetVal rand(const int type, const bool randMode = false)

allocates a random-value matrix of size 1x1 with the given type

this function allocates an random value matrix using cv::randu for uniform (randMode = false) or gausion noise (randMode = true). In case of an integer type, the uniform noise is from min(inclusiv) to max(inclusiv). For floating point types, the noise is between 0(inclusiv) and 1(exclusiv). In case of an integer type, the gausian noise mean value is (max+min)/2.0 and the standard deviation is (max-min/)6.0 to max. For floating point types, the noise mean value is 0 and the standard deviation is 1.0/3.0.

Return
retOk
See
zeros, ZerosFunc
Parameters
  • type -

    is the desired type-number

  • randMode -

    switch mode between uniform distributed(false) and normal distributed noise(true)

RetVal rand(const size_t size, const int type, const bool randMode = false)

allocates a random-value matrix of size 1 x size with the given type

this function allocates an random value matrix using cv::randu for uniform (randMode = false) or gausion noise (randMode = true). In case of an integer type, the uniform noise is from min(inclusiv) to max(inclusiv). For floating point types, the noise is between 0(inclusiv) and 1(exclusiv). In case of an integer type, the gausian noise mean value is (max+min)/2.0 and the standard deviation is (max-min/)6.0 to max. For floating point types, the noise mean value is 0 and the standard deviation is 1.0/3.0.

Return
retOk
See
zeros, ZerosFunc
Parameters
  • size -

    is the desired length of the vector

  • type -

    is the desired type-number

  • randMode -

    switch mode between uniform distributed(false) and normal distributed noise(true)

RetVal rand(const size_t sizeY, const size_t sizeX, const int type, const bool randMode = false)

allocates a random-value matrix of size sizeY x sizeX with the given type

this function allocates an random value matrix using cv::randu for uniform (randMode = false) or gausion noise (randMode = true). In case of an integer type, the uniform noise is from min(inclusiv) to max(inclusiv). For floating point types, the noise is between 0(inclusiv) and 1(exclusiv). In case of an integer type, the gausian noise mean value is (max+min)/2.0 and the standard deviation is (max-min/)6.0 to max. For floating point types, the noise mean value is 0 and the standard deviation is 1.0/3.0.

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

  • randMode -

    switch mode between uniform distributed(false) and normal distributed noise(true)

RetVal rand(const size_t sizeZ, const size_t sizeY, const size_t sizeX, const int type, const bool randMode, const unsigned char continuous = 0)

allocates a random-valued, 3D- matrix of size sizeZ x sizeY x sizeX with the given type

this function allocates an random value matrix using cv::randu for uniform (randMode = false) or gausion noise (randMode = true). In case of an integer type, the uniform noise is from min(inclusiv) to max(inclusiv). For floating point types, the noise is between 0(inclusiv) and 1(exclusiv). In case of an integer type, the gausian noise mean value is (max+min)/2.0 and the standard deviation is (max-min/)6.0 to max. For floating point types, the noise mean value is 0 and the standard deviation is 1.0/3.0.

Return
retOk
See
zeros, ZerosFunc
Parameters
  • sizeZ -

    are the number of matrix-planes

  • sizeY -

    are the number of rows

  • sizeX -

    are the number of columns

  • type -

    is the desired type-number

  • randMode -

    switch mode between uniform distributed(false) and normal distributed noise(true)

  • unsigned -

    char continuous indicates wether the data should be in one continuous block (true) or not (false)

RetVal rand(const unsigned char dimensions, const size_t * sizes, const int type, const bool randMode, const unsigned char continuous = 0)

high-level, non-templated base function for allocation of new matrix whose elements are all set to one

this function allocates an random value matrix using cv::randu for uniform (randMode = false) or gausion noise (randMode = true). In case of an integer type, the uniform noise is from min(inclusiv) to max(inclusiv). For floating point types, the noise is between 0(inclusiv) and 1(exclusiv). In case of an integer type, the gausian noise mean value is (max+min)/2.0 and the standard deviation is (max-min/)6.0 to max. For floating point types, the noise mean value is 0 and the standard deviation is 1.0/3.0.

Return
retOk
See
OnesFunc
Parameters
  • dimensions -

    indicates the number of dimensions

  • *sizes -

    is a vector with the same length than dimensions. Every element indicates the size of the specific dimension

  • type -

    is the desired data-element-type

  • randMode -

    switch mode between uniform distributed(false) and normal distributed noise(true)

  • continuous -

    indicates wether the data should be in one continuous block (true) or not (false)

RetVal eye(const int type)

sets the matrix of this data object to a two-dimensional eye-matrix of size 1, hence [1]

Return
retOk
See
ones
Parameters
  • type -

    is the desired element data-type

RetVal eye(const size_t size, const int type)

sets the matrix of this data object to a two-dimensional eye-matrix of given size

At first, a preexisting matrix is freed, before creating the eye-matrix

Return
retOk
See
freeData, create, EyeFunc
Parameters
  • size -

    is the desired size of the squared eye-matrix

  • type -

    is the desired element data-type

RetVal conj()

converts every element of the data object to its conjugate complex value

Return
retOk
See
ConjFunc
Exceptions
  • cv::Exception -

    if data type is not complex.

converts every element of the data object to its adjungate value

The adjungate is the transposed matrix, where each element is complex conjugated.

Return
retOk
See
conj
Exceptions
  • cv::Exception -

    if data type is not complex.

DataObject trans()

transposes this data object

simply toggles the transpose flag

Return
reference to this data object

DataObject mul(const DataObject & mat2, const double scale = 1.0)

DataObject div(const DataObject & mat2, const double scale = 1.0)

high-level method which does a element-wise division of elements in this matrix by elements in second source matrix.

The result is stored in a result matrix which is returned. Optionally the division can be scaled by a scaling factor, which is set to one by default.

Return
result matrix
See
DivFunc
Parameters
  • &mat2 -

    is the second source matrix

  • scale -

    is the scaling factor (default: 1.0)

DataObject squeeze()

size_t elemSize()

template < typename _Tp >
_Tp & at(const int x)

addressing method for one-dimensional data object or two-dimensional data object having at least one dimension with size 1.

Return
reference to specific element
Parameters
  • x -

    is the zero-based index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const int x)

addressing method for one-dimensional data object or two-dimensional data object having at least one dimension with size 1.

Return
const reference to specific element
Parameters
  • x -

    is the zero-based index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const unsigned int y, const unsigned int x)

addressing method for two-dimensional data object.

Return
const reference to specific element
Parameters
  • y -

    is the zero-based row-index to the element which is requested (considering any ROI)

  • x -

    is the zero-based column-index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const unsigned int y, const unsigned int x)

addressing method for two-dimensional data object.

Return
reference to specific element
Parameters
  • y -

    is the zero-based row-index to the element which is requested (considering any ROI)

  • x -

    is the zero-based column-index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const unsigned int z, const unsigned int y, const unsigned int x)

addressing method for three-dimensional data object.

Return
const reference to specific element
Parameters
  • z -

    is the zero-based z-index to the element which is requested (considering any ROI)

  • y -

    is the zero-based row-index to the element which is requested (considering any ROI)

  • x -

    is the zero-based column-index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const unsigned int z, const unsigned int y, const unsigned int x)

addressing method for three-dimensional data object.

Return
reference to specific element
Parameters
  • z -

    is the zero-based z-index to the element which is requested (considering any ROI)

  • y -

    is the zero-based row-index to the element which is requested (considering any ROI)

  • x -

    is the zero-based column-index to the element which is requested (considering any ROI)

template < typename _Tp >
_Tp & at(const unsigned int * idx)

addressing method for n-dimensional data object.

Remark
The idx vector must indicate the indizes in “virtual”-order (user-friendly order)
Return
const reference to specific element
Parameters
  • *idx -

    is vector whose size is equal to the data object’s dimensions. Each entry indicates the zero-based index of its specific dimension considering any ROI

template < typename _Tp >
_Tp & at(const unsigned int * idx)

addressing method for n-dimensional data object.

Remark
The idx vector must indicate the indizes in “virtual”-order (user-friendly order)
Return
reference to specific element
Parameters
  • *idx -

    is vector whose size is equal to the data object’s dimensions. Each entry indicates the zero-based index of its specific dimension considering any ROI

DataObject at(const ito::Range rowRange, const ito::Range colRange)

addressing method for two-dimensional data object with two given range-values. returns shallow copy of addressed regions.

addressing method for two-dimensional data object with two given range-values. returns shallow copy of addressed regions

Return
new data object which is a shallow copy of this data object and whose ROI is set to the given row- and col-ranges
Parameters
  • rowRange -

    is the desired rowRange which should be in the new ROI (considers any existing ROI, too)

  • colRange -

    is the desired colRange which should be in the new ROI (considers any existing ROI, too)

Exceptions
  • cv::Exception -

    if number of dimensions is unequal to two.

DataObject at(ito::Range * ranges)

addressing method for n-dimensional data object with n given range-values. returns shallow copy of addressed regions

If any of the given ranges exceed the boundaries of its corresponding dimension, the range will be set to the boundaries. ranges will be given in “virtual” order, hence, the transpose-flag is considered by this method.

Return
new data object with shallow copy of this data object and adjusted ROI with respect to the given ranges
See
GetRangeFunc
Parameters
  • *ranges -

    is vector of desired ranges for each dimension

uchar * rowPtr(const size_t matNum, const int y)

returns pointer to the data in the y-th row in the 2d-matrix plane matNum

cast this pointer to the data type of the matrix elements (as pointer).

Remark
No further error checking (e.g. boundaries)
Return
data-pointer

const uchar * rowPtr(const size_t matNum, const int y)

returns pointer to the data in the y-th row in the 2d-matrix plane matNum

cast this pointer to the data type of the matrix elements (as pointer).

Remark
No further error checking (e.g. boundaries)
Return
data-pointer

DataObject row(const int selRow)

high-level method which makes a new header for the specified matrix row and returns it. The underlying data of the new matrix is shared with the original matrix.

Return
new data object
See
RowFunc
Parameters
  • selRow -

    is the specific zero-based row index

Exceptions
  • cv::Exception -

    if dimension is unequal to two.

DataObject col(const int selCol)

high-level method which makes a new header for the specified matrix column and returns it. The underlying data of the new matrix is shared with the original matrix.

Return
new data object
See
ColFunc
Parameters
  • selCol -

    is the specific zero-based row index

Exceptions
  • cv::Exception -

    if dimension is unequal to two.

DataObject & adjustROI(const int dtop, const int dbottom, const int dleft, const int dright)

adjust submatrix size and position within the two-dimensional data-object

changes the boundaries of the ROI of a two-dimensional data object by the given incremental values

Remark
the parameters indicates the shift with respect to the virtual order of the matrix, hence, the transpose flag is considered in this method
Return
reference to this data object
See
adjustROI
Parameters
  • dtop -

    The shift of the top submatrix boundary upwards (positive value means upwards)

  • dbottom -

    The shift of the bottom submatrix boundary downwards (positive value means downwards)

  • dleft -

    The shift of the left submatrix boundary to the left (positive value means to the left)

  • dright -

    The shift of the right submatrix boundary to the right (positive value means to the right)

Exceptions
  • cv::Exception -

    if data object is not two-dimensional

DataObject & adjustROI(const unsigned char dims, const int * lims)

adjust submatrix size and position within the n-dimensional data-object

changes the boundaries of the ROI of a n-dimensional data object by the given incremental values

dims is the number of dimensions

Return
reference to this data object
Remark
lims indicates the shift with respect to the virtual order of the matrix, hence, the transpose flag is considered in this method
See
adjustROI
Parameters
  • *lims -

    is a integer array whose length is 2*dims. For every dimension, two adjacent values indicates the shift of the ROI. The first of both values indicates the shift of the ROI towards the first element in the matrix (positive direction). The second value indicates the shift of the ROI towards the last element in the matrix (positive direction).

RetVal locateROI(int * wholeSizes, int * offsets)

method locates ROI of this data object within its original data block

locates the boundaries of the ROI of a n-dimensional data object and returns the original size and the distances to the physical borders

long description

Return
retOk
Parameters
  • *wholeSizes -

    is an allocated array of size m_dims, which is filled with the original matrix-sizes (considering the transpose-flag, hence, the output is in user-friendly form)

  • *offsets -

    is dimension-wise offset in order to get from the original first element of the matrix to the subpart within the region of interest, array must be pre-allocated, too.

RetVal locateROI(int * lims)

method get ROI of this data object within its original data block

locates the boundaries of the ROI of a n-dimensional data object the distances to the physical borders

dims is the number of dimensions

Return
retOk
Parameters
  • *lims -

    is a integer array whose length is 2*dims. For every dimension, two adjacent values indicates the shift of the ROI. The first of both values indicates the shift of the ROI towards the first element in the matrix (positive direction). The second value indicates the shift of the ROI towards the last element in the matrix (positive direction).

template < typename _Tp >
RetVal copyFromData2D(const _Tp * src, const size_t sizeX, const size_t sizeY)

copies 2D continuous data into data object, data object must have correct size and type, otherwise an error is returned

template < typename _Tp >
RetVal copyFromData2D(const _Tp * src, const size_t sizeX, const size_t sizeY, const int x0, const int y0, const size_t width, const size_t height)

copies 2D continuous data into data object, data object must have correct size and type, otherwise an error is returned

template < typename _Tp >
RetVal checkType(const _Tp * src)

verifies if the data type of elements in this data object is equal to the type of the argument.

template < typename T2 >
operator T2()

cast operator for data object

cast operator, tries to cast this data object to another element type

usage: res = static_cast<ito::float32>(sourceDataObject)

Return
cast data object
See
convertTo, CastFunc
Exceptions
  • cv::Exception -

    if cast failed, e.g. if cast not possible or types unknown

class MROI

Public Functions

MROI()

size_t operator[](const int dim)

bool operator==(const MROI & rroi)

Public Members

size_t * m_p

class MSize

Public Functions

MSize()

size_t operator[](const int dim)

operator const size_t *()

bool operator==(const MSize & sz)

bool operator!=(const MSize & sz)

Public Members

size_t * m_p

This Page