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. | |
MatrixSubRectIterator (Type *ptData, int matrixWidth, int subRectX, int subRectY, int subRectWidth, int subRectHeight) | |
MatrixSubRectIterator & | operator= (const MatrixSubRectIterator &other) |
const MatrixSubRectIterator & | operator= (const MatrixSubRectIterator &other) const |
const Type & | operator* () const |
retuns a reference of the current pixel value (const) | |
Type & | operator* () |
retuns a reference of the current pixel value | |
MatrixSubRectIterator & | operator++ () |
moves to the next iterator position (Prefix ++it) | |
const MatrixSubRectIterator & | operator++ () const |
const version of pre increment operator | |
MatrixSubRectIterator | operator++ (int) |
const MatrixSubRectIterator | operator++ (int) const |
const version of post increment operator | |
bool | inSubRect () const |
to check if iterator is still inside the ROI | |
bool | operator!= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
bool | operator== (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
bool | operator< (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
bool | operator> (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
bool | operator<= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
bool | operator>= (const MatrixSubRectIterator< Type > &it) const |
compare two iterators | |
int | getSubRectWidth () const |
returns the length of each row processed by this iterator | |
int | getSubRectHeight () const |
void | incRow (int numLines=1) const |
move the pixel vertically forward | |
int | x () |
returns the current x position of the iterator (wrt matrix origin); | |
int | y () |
returns the current y position of the iterator (wrt matrix origin) | |
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 | |
int | m_subRectWidth |
sub rect size of the iterator | |
int | m_subRectHeight |
int | m_lineStep |
result of m_matrixWidth - m_subRectWidth | |
Type * | m_dataOrigin |
pointer to the upper matrix data origin (upper left element) | |
Type * | m_dataCurr |
pointer to the current data element | |
Type * | m_dataEnd |
pointer to the first element behind the subrect | |
Type * | m_currLineEnd |
pointer to the first invalid element of the current line |
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-------|
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.
Instead, const-ness relates to the underlying data block is referenced by the iterator instance.
icl::math::MatrixSubRectIterator< Type >::MatrixSubRectIterator | ( | ) | [inline] |
Default Constructor.
Creates an MatrixSubRectIterator object
icl::math::MatrixSubRectIterator< Type >::MatrixSubRectIterator | ( | Type * | ptData, |
int | matrixWidth, | ||
int | subRectX, | ||
int | subRectY, | ||
int | subRectWidth, | ||
int | subRectHeight | ||
) | [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 |
static const MatrixSubRectIterator<Type> icl::math::MatrixSubRectIterator< Type >::create_end_iterator | ( | const Type * | dataOrigin, |
int | matrixWidth, | ||
int | subRectX, | ||
int | subRectY, | ||
int | subRectWidth, | ||
int | subRectHeight | ||
) | [inline, static] |
int icl::math::MatrixSubRectIterator< Type >::getSubRectHeight | ( | ) | const [inline] |
int icl::math::MatrixSubRectIterator< Type >::getSubRectWidth | ( | ) | const [inline] |
returns the length of each row processed by this iterator
void icl::math::MatrixSubRectIterator< Type >::incRow | ( | int | numLines = 1 | ) | const [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 |
void icl::math::MatrixSubRectIterator< Type >::init | ( | ) | [inline, protected] |
bool icl::math::MatrixSubRectIterator< Type >::inSubRect | ( | ) | const [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
bool icl::math::MatrixSubRectIterator< Type >::operator!= | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
const Type& icl::math::MatrixSubRectIterator< Type >::operator* | ( | ) | const [inline] |
retuns a reference of the current pixel value (const)
changes on *p (p is of type MatrixSubRectIterator) will effect the image data
Type& icl::math::MatrixSubRectIterator< Type >::operator* | ( | ) | [inline] |
retuns a reference of the current pixel value
changes on *p (p is of type MatrixSubRectIterator) will effect the image data
MatrixSubRectIterator& icl::math::MatrixSubRectIterator< Type >::operator++ | ( | ) | [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.
const MatrixSubRectIterator& icl::math::MatrixSubRectIterator< Type >::operator++ | ( | ) | const [inline] |
const version of pre increment operator
MatrixSubRectIterator icl::math::MatrixSubRectIterator< Type >::operator++ | ( | int | ) | [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.
const MatrixSubRectIterator icl::math::MatrixSubRectIterator< Type >::operator++ | ( | int | ) | const [inline] |
const version of post increment operator
bool icl::math::MatrixSubRectIterator< Type >::operator< | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
bool icl::math::MatrixSubRectIterator< Type >::operator<= | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
MatrixSubRectIterator& icl::math::MatrixSubRectIterator< Type >::operator= | ( | const MatrixSubRectIterator< Type > & | other | ) | [inline] |
Reimplemented in icl::core::ImgIterator< Type >.
const MatrixSubRectIterator& icl::math::MatrixSubRectIterator< Type >::operator= | ( | const MatrixSubRectIterator< Type > & | other | ) | const [inline] |
Reimplemented in icl::core::ImgIterator< Type >.
bool icl::math::MatrixSubRectIterator< Type >::operator== | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
bool icl::math::MatrixSubRectIterator< Type >::operator> | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
bool icl::math::MatrixSubRectIterator< Type >::operator>= | ( | const MatrixSubRectIterator< Type > & | it | ) | const [inline] |
compare two iterators
int icl::math::MatrixSubRectIterator< Type >::x | ( | ) | [inline] |
returns the current x position of the iterator (wrt matrix origin);
int icl::math::MatrixSubRectIterator< Type >::y | ( | ) | [inline] |
returns the current y position of the iterator (wrt matrix origin)
Type* icl::math::MatrixSubRectIterator< Type >::m_currLineEnd [mutable, protected] |
pointer to the first invalid element of the current line
Type* icl::math::MatrixSubRectIterator< Type >::m_dataCurr [mutable, protected] |
pointer to the current data element
Type* icl::math::MatrixSubRectIterator< Type >::m_dataEnd [protected] |
pointer to the first element behind the subrect
Type* icl::math::MatrixSubRectIterator< Type >::m_dataOrigin [protected] |
pointer to the upper matrix data origin (upper left element)
int icl::math::MatrixSubRectIterator< Type >::m_lineStep [protected] |
result of m_matrixWidth - m_subRectWidth
int icl::math::MatrixSubRectIterator< Type >::m_matrixWidth [protected] |
corresponding matrix width
int icl::math::MatrixSubRectIterator< Type >::m_subRectHeight [protected] |
int icl::math::MatrixSubRectIterator< Type >::m_subRectWidth [protected] |
sub rect size of the iterator