Image Component Library (ICL)
|
Iterator class used to iterate through a sub rect of 2D data. More...
#include <MatrixSubRectIterator.h>
Public Member Functions | |
MatrixSubRectIterator () | |
Default Constructor. More... | |
MatrixSubRectIterator (Type *ptData, int matrixWidth, int subRectX, int subRectY, int subRectWidth, int subRectHeight) | |
MatrixSubRectIterator & | assign (const MatrixSubRectIterator &other) |
const MatrixSubRectIterator & | operator= (const MatrixSubRectIterator &other) const |
const Type & | operator * () const |
retuns a reference of the current pixel value (const) More... | |
Type & | operator * () |
retuns a reference of the current pixel value More... | |
MatrixSubRectIterator & | operator++ () |
moves to the next iterator position (Prefix ++it) More... | |
const MatrixSubRectIterator & | operator++ () const |
const version of pre increment operator More... | |
MatrixSubRectIterator | operator++ (int) |
const MatrixSubRectIterator | operator++ (int) const |
const version of post increment operator More... | |
bool | inSubRect () const |
to check if iterator is still inside the ROI More... | |
bool | operator!= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
bool | operator== (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
bool | operator< (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
bool | operator> (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
bool | operator<= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
bool | operator>= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators More... | |
int | getSubRectWidth () const |
returns the length of each row processed by this iterator More... | |
int | getSubRectHeight () const |
void | incRow (int numLines=1) const |
move the pixel vertically forward More... | |
int | x () |
returns the current x position of the iterator (wrt matrix origin); More... | |
int | y () |
returns the current y position of the iterator (wrt matrix origin) More... | |
Static Public Member Functions | |
static const MatrixSubRectIterator< Type > | create_end_iterator (const Type *dataOrigin, int matrixWidth, int subRectX, int subRectY, int subRectWidth, int subRectHeight) |
Protected Member Functions | |
void | init () |
Protected Attributes | |
int | m_matrixWidth |
corresponding matrix width More... | |
int | m_subRectWidth |
sub rect size of the iterator More... | |
int | m_subRectHeight |
int | m_lineStep |
result of m_matrixWidth - m_subRectWidth More... | |
Type * | m_dataOrigin |
pointer to the upper matrix data origin (upper left element) More... | |
Type * | m_dataCurr |
pointer to the current data element More... | |
Type * | m_dataEnd |
pointer to the first element behind the subrect More... | |
Type * | m_currLineEnd |
pointer to the first invalid element of the current line More... | |
Iterator class used to iterate through a sub rect of 2D data.
The MatrixSubRectIterator is a utility to iterate line by line through all elements of a sub-rectangle of a row-major-order aligned data block.
The following ASCII image shows an images ROI.
1st element | ....|.................... ....+->Xoooooooo......... --- .......ooooooooo......... | .......ooooooooo......... Rect-Height .......ooooooooo......... | .......ooooooooo......... --- ......................... |-RectW-| |---------MatrixW-------|
\section CONST const-ness Please note that the const-ness of an MatrixSubRectIterator instance does not say anything about the sturcture itselft. Hence also const MatrixSubRectIterators can be 'moved' using ++-operators or incRow() method.\n Instead, const-ness relates to the underlying data block is referenced by the iterator instance.
|
inline |
Default Constructor.
Creates an MatrixSubRectIterator object
|
inline |
2nd Constructor creates an MatrixSubRectIterator object with Type "Type"
ptData | pointer to the corresponding channel data |
matrixWidth | width of the corresponding image |
subRectX | ROI upper-left X-coordinate |
subRectY | ROI upper-left Y-coordinate |
subRectWidth | ROI width |
subRectHeight | ROI height |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
returns the length of each row processed by this iterator
|
inline |
move the pixel vertically forward
current x value is hold, the current y-value is incremented by iLines
numLines | amount of lines to jump over |
|
inlineprotected |
|
inline |
to check if iterator is still inside the ROI
This function was replaced by STL-like begin(), end() logic Although in some cases it might be quite useful, so we renamed it rather than deleting it
|
inline |
retuns a reference of the current pixel value (const)
changes on *p (p is of type MatrixSubRectIterator) will effect the image data
|
inline |
retuns a reference of the current pixel value
changes on *p (p is of type MatrixSubRectIterator) will effect the image data
|
inline |
compare two iterators
|
inline |
moves to the next iterator position (Prefix ++it)
The image ROI will be scanned line by line beginning on the bottom left iterator.
+-- begin here (index 0) | .......|................. .......V................. .......012+-->+8<---------- first line wrap after .......9++++++++......... this pixel (index 8) .......+++++++++......... .......+++++++++......... .......++++++++X<---------- last valid pixel ....+->I................. | 'I' is the first invalid iterator (p.inRegion() will become false)
In most cases The ++ operator will just increase the current x position and update the reference to the current pixel data. If the end of a line is reached, then the position is set to the beginning of the next line.
|
inline |
const version of pre increment operator
|
inline |
postfix operator++ (used -O3 to avoid loss of performace when using the "it++"-operator In most cases the "++it"-operator will ensure best performace.
|
inline |
const version of post increment operator
|
inline |
compare two iterators
|
inline |
compare two iterators
|
inline |
|
inline |
compare two iterators
|
inline |
compare two iterators
|
inline |
compare two iterators
|
inline |
returns the current x position of the iterator (wrt matrix origin);
|
inline |
returns the current y position of the iterator (wrt matrix origin)
|
mutableprotected |
pointer to the first invalid element of the current line
|
mutableprotected |
pointer to the current data element
|
protected |
pointer to the first element behind the subrect
|
protected |
pointer to the upper matrix data origin (upper left element)
|
protected |
result of m_matrixWidth - m_subRectWidth
|
protected |
corresponding matrix width
|
protected |
|
protected |
sub rect size of the iterator