Allow iteration through an image in tile order. More...
#include <mi32/imgtilit.h>
Public Member Functions | |
| IMAGE_TILE_ITERATOR (INT32 numcols, INT32 numrows, INT32 tilecols, INT32 tilerows, INT32 FirstTileColumns, INT32 FirstTileRows) | |
| IMAGE_TILE_ITERATOR (INT32 numcols, INT32 numrows, INT32 tilecols, INT32 tilerows) | |
| IMAGE_TILE_ITERATOR (const RVC::RASTER &ObjRaster) | |
| INT32 | GetColumn () const |
| INT32 | GetLine () const |
| INT32 | GetMaxColumns () const |
| INT32 | GetNumColumns () const |
| INT32 | GetNumSpans () const |
| INT32 | GetRow () const |
| INT32 | GetSpan () const |
| bool | IsDone () const |
| IMAGE_TILE_ITERATOR & | operator++ () |
| void | Reset () |
Allow iteration through an image in tile order.
In many cases, all cells in an image are to be processed, but the order is not important to the algorithm. In this case, it is most efficient to read or write the image in tile order, processing all cells in one tile before moving to the next tile. This class simplifies and encapsulates the details of iterating through the tiles and spans within each tile.
The following code fragment shows how this class is used for RVC rasters to compute the minimum and maximum cell values in the raster. Error checking and null cell handling issues are ignored for simplicity.
RVC::RASTER ObjRaster; ObjRaster.Open(ObjItemRaster); IMAGE_TILE_ITERATOR it(ObjRaster); DOUBLE_ARRAY<double> rowbuf; rowbuf.Resize(it.GetMaxColumns()); double minval = DBL_MAX, maxval = DBL_MIN; for (; (!it.IsDone()); ++it) { ObjRaster.Read(it.GetRow(),it.GetColumn(),rowbuf,it.GetNumColumns()); for (INT32 col = 0; (col < it.GetNumColumns()); ++col) { if (rowbuf[col] < minval) minval = rowbuf[col]; if (rowbuf[col] > maxval) maxval = rowbuf[col]; } }
| IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR | ( | const RVC::RASTER & | ObjRaster | ) |
Construct iterator using raster object.
| ObjRaster | RVC::RASTER object that is already opened |
| IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR | ( | INT32 | numcols, | |
| INT32 | numrows, | |||
| INT32 | tilecols, | |||
| INT32 | tilerows | |||
| ) |
Construct iterator for given image and tile size.
| numcols | Number of columns in image | |
| numrows | Number of rows in image | |
| tilecols | Number of columns in a single tile | |
| tilerows | Number of rows in a single tile |
| IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR | ( | INT32 | numcols, | |
| INT32 | numrows, | |||
| INT32 | tilecols, | |||
| INT32 | tilerows, | |||
| INT32 | FirstTileColumns, | |||
| INT32 | FirstTileRows | |||
| ) |
Construct iterator for given image and tile size with different size for first tile row/column.
| numcols | Number of columns in image | |
| numrows | Number of rows in image | |
| tilecols | Number of columns in a single tile | |
| tilerows | Number of rows in a single tile | |
| FirstTileColumns | Number of columns in first tile | |
| FirstTileRows | Number of rows in first tile |
| INT32 IMAGE_TILE_ITERATOR::GetColumn | ( | ) | const [inline] |
Get starting column for current span.
| INT32 IMAGE_TILE_ITERATOR::GetLine | ( | ) | const [inline] |
Get row within image for current span.
| INT32 IMAGE_TILE_ITERATOR::GetMaxColumns | ( | ) | const [inline] |
Get maximum number of columns.
| INT32 IMAGE_TILE_ITERATOR::GetNumColumns | ( | ) | const [inline] |
Get number of columns in current span.
| INT32 IMAGE_TILE_ITERATOR::GetNumSpans | ( | ) | const [inline] |
Get total number of spans.
| INT32 IMAGE_TILE_ITERATOR::GetRow | ( | ) | const [inline] |
Get row within image for current span.
| INT32 IMAGE_TILE_ITERATOR::GetSpan | ( | ) | const [inline] |
Get current span number.
| bool IMAGE_TILE_ITERATOR::IsDone | ( | ) | const [inline] |
Determine if at end of image.
| IMAGE_TILE_ITERATOR& IMAGE_TILE_ITERATOR::operator++ | ( | ) |
Increment to next span.
| void IMAGE_TILE_ITERATOR::Reset | ( | ) |
Reset to beginning.
1.6.1