te::rst::BandIteratorWindow< T > Class Template Reference

It implements and iterator to "navigate" over a single band, optimized by a window structure (e.g. 3x3, 5x5, etc). Examples include filters, moving windows, morphology, etc. More...

#include <BandIteratorWindow.h>

Public Member Functions

 BandIteratorWindow (Band const *const b, std::size_t w, const std::size_t h)
 Constructor. More...
 
 BandIteratorWindow (const BandIteratorWindow &rhs)
 Copy constructor. More...
 
 BandIteratorWindow ()
 Constructor. More...
 
unsigned int getColumn () const
 Returns the current column in iterator. More...
 
unsigned int getRow () const
 Returns the current row in iterator. More...
 
getValue () const
 Returns the value in current position (column, row) from iterator. More...
 
getValue (int c, int r) const
 Returns the value in a relative position to the center pixel currently pointed by iterator. More...
 
bool operator!= (const BandIteratorWindow &rhs) const
 Differece operator. More...
 
BandIteratorWindow operator* ()
 
void operator++ ()
 Advances to the next position. More...
 
void operator-- ()
 Returns to the previous position. More...
 
BandIteratorWindowoperator= (const BandIteratorWindow &rhs)
 Assignment operator. More...
 
void replaceBlocks ()
 Replaces the current bufferized blocks. More...
 
 ~BandIteratorWindow ()
 Destructor. More...
 

Static Public Member Functions

static BandIteratorWindow begin (Band const *const b, std::size_t w, const std::size_t h)
 Returns an iterator referring to the first value of the band. More...
 
static BandIteratorWindow end (Band const *const b, std::size_t w, const std::size_t h)
 Returns an iterator referring to after the end of the iterator. More...
 

Private Member Functions

T * getBlock (int c, int r) const
 Returns the correct block where relative value is used. More...
 
int getRelativeIndex (int c, int r) const
 Returns the correct index where the relative value is in the relative block. More...
 

Private Attributes

Band const * m_band
 The band from where to get the values. More...
 
int m_blkh
 The internal block height. More...
 
int m_blkw
 The internal block width. More...
 
int m_blkx
 The position in X of the current block. More...
 
int m_blky
 The position in Y of the current block. More...
 
std::vector< T * > m_blocks
 A vector of internal blocks, to provide fast access to window elements. More...
 
int m_cblock
 The index of the central block;. More...
 
te::rst::GetBufferValueFPtr m_getBuff
 A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...). More...
 
te::rst::GetBufferValueFPtr m_getBuffI
 A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble). More...
 
int m_h
 The height of the window to iterate. More...
 
int m_i
 The actual position inside the block. More...
 
int m_lastblksize
 The number of pixels inside the last block. More...
 
int m_nblocksx
 The number of blocks in X direction. More...
 
int m_nblocksy
 The number of blocks in Y direction. More...
 
int m_npxlsblk
 The maximum number of pixels inside the block. More...
 
int m_nvblocksx
 The amount of blocks in direction X in vector of internal blocks. More...
 
int m_nvblocksy
 The amount of blocks in direction Y in vector of internal blocks. More...
 
te::rst::SetBufferValueFPtr m_setBuff
 A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...). More...
 
te::rst::SetBufferValueFPtr m_setBuffI
 A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble). More...
 
int m_w
 The width of the window to iterate. More...
 

Detailed Description

template<class T>
class te::rst::BandIteratorWindow< T >

It implements and iterator to "navigate" over a single band, optimized by a window structure (e.g. 3x3, 5x5, etc). Examples include filters, moving windows, morphology, etc.

See also
te::rst::Band

Definition at line 54 of file BandIteratorWindow.h.

Constructor & Destructor Documentation

◆ BandIteratorWindow() [1/3]

◆ BandIteratorWindow() [2/3]

◆ BandIteratorWindow() [3/3]

template<class T >
te::rst::BandIteratorWindow< T >::BandIteratorWindow ( )

Constructor.

Definition at line 284 of file BandIteratorWindow.h.

◆ ~BandIteratorWindow()

template<class T >
te::rst::BandIteratorWindow< T >::~BandIteratorWindow ( )

Destructor.

Definition at line 304 of file BandIteratorWindow.h.

References te::common::FreeContents().

Member Function Documentation

◆ begin()

template<class T >
te::rst::BandIteratorWindow< T > te::rst::BandIteratorWindow< T >::begin ( Band const *const  b,
std::size_t  w,
const std::size_t  h 
)
static

Returns an iterator referring to the first value of the band.

Parameters
bThe band to iterate.
wThe width of the window to iterate.
hThe height of the window to iterate.

Definition at line 433 of file BandIteratorWindow.h.

◆ end()

template<class T >
te::rst::BandIteratorWindow< T > te::rst::BandIteratorWindow< T >::end ( Band const *const  b,
std::size_t  w,
const std::size_t  h 
)
static

Returns an iterator referring to after the end of the iterator.

Parameters
bThe band to iterate.
wThe width of the window to iterate.
hThe height of the window to iterate.

Definition at line 438 of file BandIteratorWindow.h.

References te::rst::Band::getProperty(), te::rst::BandIteratorWindow< T >::m_blky, and te::rst::BandProperty::m_nblocksy.

◆ getBlock()

template<class T >
T * te::rst::BandIteratorWindow< T >::getBlock ( int  c,
int  r 
) const
private

Returns the correct block where relative value is used.

Parameters
rThe row relative to the center pixel.
cThe column relative to the center pixel.
Returns
The correct block.

Definition at line 465 of file BandIteratorWindow.h.

◆ getColumn()

template<class T >
unsigned int te::rst::BandIteratorWindow< T >::getColumn ( ) const

Returns the current column in iterator.

Definition at line 314 of file BandIteratorWindow.h.

◆ getRelativeIndex()

template<class T >
int te::rst::BandIteratorWindow< T >::getRelativeIndex ( int  c,
int  r 
) const
private

Returns the correct index where the relative value is in the relative block.

Parameters
rThe row relative to the center pixel.
cThe column relative to the center pixel.
Returns
The correct index.

Definition at line 476 of file BandIteratorWindow.h.

◆ getRow()

template<class T >
unsigned int te::rst::BandIteratorWindow< T >::getRow ( ) const

Returns the current row in iterator.

Definition at line 309 of file BandIteratorWindow.h.

◆ getValue() [1/2]

template<class T >
T te::rst::BandIteratorWindow< T >::getValue ( ) const

Returns the value in current position (column, row) from iterator.

Definition at line 319 of file BandIteratorWindow.h.

◆ getValue() [2/2]

template<class T >
T te::rst::BandIteratorWindow< T >::getValue ( int  c,
int  r 
) const

Returns the value in a relative position to the center pixel currently pointed by iterator.

Parameters
rThe row relative to the center pixel.
cThe column relative to the center pixel.
Warning
The caller is responsible for providing correct values for the range [c x r].
Note
In a 5x5 window, the expected values for [c x r] in this method are in the interval [-2, +2].

Definition at line 329 of file BandIteratorWindow.h.

◆ operator!=()

template<class T >
bool te::rst::BandIteratorWindow< T >::operator!= ( const BandIteratorWindow< T > &  rhs) const

Differece operator.

Parameters
rhsThe right-hand side to compare.
Returns
Returns true if the iterators are at different positions, or false otherwise.

Definition at line 428 of file BandIteratorWindow.h.

References te::rst::BandIteratorWindow< T >::m_blky.

◆ operator*()

template<class T >
te::rst::BandIteratorWindow< T > te::rst::BandIteratorWindow< T >::operator* ( )

Definition at line 396 of file BandIteratorWindow.h.

◆ operator++()

template<class T >
void te::rst::BandIteratorWindow< T >::operator++ ( )

Advances to the next position.

Definition at line 339 of file BandIteratorWindow.h.

◆ operator--()

template<class T >
void te::rst::BandIteratorWindow< T >::operator-- ( )

Returns to the previous position.

Definition at line 368 of file BandIteratorWindow.h.

◆ operator=()

◆ replaceBlocks()

template<class T >
void te::rst::BandIteratorWindow< T >::replaceBlocks ( )

Replaces the current bufferized blocks.

Definition at line 447 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

Member Data Documentation

◆ m_band

template<class T>
Band const* te::rst::BandIteratorWindow< T >::m_band
private

The band from where to get the values.

Definition at line 185 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_blkh

template<class T>
int te::rst::BandIteratorWindow< T >::m_blkh
private

◆ m_blkw

template<class T>
int te::rst::BandIteratorWindow< T >::m_blkw
private

◆ m_blkx

template<class T>
int te::rst::BandIteratorWindow< T >::m_blkx
private

The position in X of the current block.

Definition at line 181 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::operator=().

◆ m_blky

template<class T>
int te::rst::BandIteratorWindow< T >::m_blky
private

◆ m_blocks

template<class T>
std::vector<T*> te::rst::BandIteratorWindow< T >::m_blocks
private

A vector of internal blocks, to provide fast access to window elements.

Definition at line 184 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_cblock

template<class T>
int te::rst::BandIteratorWindow< T >::m_cblock
private

The index of the central block;.

Definition at line 179 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_getBuff

template<class T>
te::rst::GetBufferValueFPtr te::rst::BandIteratorWindow< T >::m_getBuff
private

A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...).

Definition at line 186 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_getBuffI

template<class T>
te::rst::GetBufferValueFPtr te::rst::BandIteratorWindow< T >::m_getBuffI
private

A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble).

Definition at line 187 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_h

template<class T>
int te::rst::BandIteratorWindow< T >::m_h
private

The height of the window to iterate.

Definition at line 171 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_i

template<class T>
int te::rst::BandIteratorWindow< T >::m_i
private

The actual position inside the block.

Definition at line 180 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::operator=().

◆ m_lastblksize

template<class T>
int te::rst::BandIteratorWindow< T >::m_lastblksize
private

The number of pixels inside the last block.

Definition at line 183 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_nblocksx

template<class T>
int te::rst::BandIteratorWindow< T >::m_nblocksx
private

The number of blocks in X direction.

Definition at line 175 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_nblocksy

template<class T>
int te::rst::BandIteratorWindow< T >::m_nblocksy
private

The number of blocks in Y direction.

Definition at line 176 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_npxlsblk

template<class T>
int te::rst::BandIteratorWindow< T >::m_npxlsblk
private

The maximum number of pixels inside the block.

Definition at line 174 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_nvblocksx

template<class T>
int te::rst::BandIteratorWindow< T >::m_nvblocksx
private

The amount of blocks in direction X in vector of internal blocks.

Definition at line 177 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_nvblocksy

template<class T>
int te::rst::BandIteratorWindow< T >::m_nvblocksy
private

The amount of blocks in direction Y in vector of internal blocks.

Definition at line 178 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow(), and te::rst::BandIteratorWindow< T >::operator=().

◆ m_setBuff

template<class T>
te::rst::SetBufferValueFPtr te::rst::BandIteratorWindow< T >::m_setBuff
private

A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...).

Definition at line 188 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_setBuffI

template<class T>
te::rst::SetBufferValueFPtr te::rst::BandIteratorWindow< T >::m_setBuffI
private

A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble).

Definition at line 189 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

◆ m_w

template<class T>
int te::rst::BandIteratorWindow< T >::m_w
private

The width of the window to iterate.

Definition at line 170 of file BandIteratorWindow.h.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().


The documentation for this class was generated from the following file: